On Wed, Jan 26, 2022 at 6:20 PM David Gow davidgow@google.com wrote:
On Thu, Jan 27, 2022 at 3:55 AM 'Daniel Latypov' via KUnit Development kunit-dev@googlegroups.com wrote:
On Thu, Jan 20, 2022 at 9:19 AM Daniel Latypov dlatypov@google.com wrote:
That being said, I can live with the current solution, but'd ideally like a comment or something to make the return value Tuple a bit more obvious.
A comment to explain that Tuple == multiple return values from a func? Or something else?
Friendly ping. Do we want a comment like this?
# Note: Python uses tuples internally for multiple return values def foo() -> Tuple[int, int] return 0, 1
Whoops -- forgot to send my response to this.
I was less worried about explaining the concept of multiple return values, and more about naming what the return values were: that the first one is the result information, and the second is the parsed test.
That being said, it's reasonably obvious from the types in this case, so I'm okay leaving this as-is, though in general I'm wary of tuples when the order doesn't matter, and a struct-style thing (with named members) fits that better.
Ack. Yeah, in this case I don't think creating a new type to name each value is worth it. From what I've seen of python codebases, this info is usually captured in docstrings, but yeah, this particular case seems straightforward enough that it doesn't need it.
I'm no Python expert though, so don't let my whinging get too much in the way.
-- David