[Python-ideas] How assignment should work with generators?
greg.ewing at canterbury.ac.nz
Sat Dec 2 16:51:05 EST 2017
C Anthony Risinger wrote:
> * Unpacking is destructuring not pattern matching.
We're just arguing about the definition of terms now. The point
I was making is that unpacking is fundamentally a declarative
construct, or at least that's how I think about it.
I used the term "pattern matching" because that's something
unambiguously declarative. Terms like "unpacking" and
"destructuring" can be misleading to the uninitiated, because
they sound like they're doing something destructive to the
> * Tuple syntax is commas, paren, one, or both.
The only situation where parentheses make a tuple is the
case of the 0-tuple. Even then, you could argue that the
tuple is really the empty space between the parens, and
the parens are only there to make it visible. :-)
I agree that this is out of step with mathematical
convention, but it does make multiple-value returns look
nice. There you don't really want to have to think
about the fact that there's a tuple involved.
More information about the Python-ideas