Death to tuples!
Alex Martelli
aleax at mail.comcast.net
Mon Nov 28 22:30:39 EST 2005
Mike Meyer <mwm at mired.org> wrote:
...
> concept of tuple unpacking. When names are bound, you can use a
> "tuple" for an lvalue, and the sequence on the rhs will be "unpacked"
> into the various names in the lvalue:
>
> for key, value = mydict.iteritems(): ...
> a, (b, c) = (1, 2), (3, 4)
>
> I think of the parameters of a function as just another case of
> this; any solution that works for the above two should work for
> function paremeters as well.
I agree that conceptually the situations are identical, it's just that
currently using [ ] on the left of an equal sign is OK, while using them
in a function's signature is a syntax error. No doubt that part of the
syntax could be modified (expanded), I imagine that nothing bad would
follow as a consequence.
Alex
More information about the Python-list
mailing list