multiple assignment

Fredrik Lundh fredrik at pythonware.com
Wed Mar 22 04:59:37 EST 2006


Christoph Zwerschke wrote:

> You're right, that would not be so far off.
> But then, the following should be also supported:
>
> *x, y = a # x, y = a[:-1], y = a[-1]
> x, *y, z = a # x, y, z = a[0], a[1:-1], a[-1]
>
> Of course, there can be only one variable with an asterisk.
> (But note that in the situation of a function taking parameters, that
> variable must always be the last.)
>
> But I don't know if this is really useful enough...

things like this are proposed from time to time (I haven't looked, but
there might even be a PEP somewhere).  however, function calls and
assignments are two different things, and I'm not convinced that it's
not yet another hypergeneralization...

</F>






More information about the Python-list mailing list