Re: multiple assignment
- From: "Fredrik Lundh" <fredrik@xxxxxxxxxxxxxx>
- Date: Wed, 22 Mar 2006 10:59:37 +0100
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>
.
- References:
- multiple assignment
- From: Anand
- Re: multiple assignment
- From: Christoph Zwerschke
- multiple assignment
- Prev by Date: Using MAPI (simplemapi.py)
- Next by Date: Default/editable string to raw_input
- Previous by thread: Re: multiple assignment
- Next by thread: Re: multiple assignment
- Index(es):