Anonymus functions revisited

George Sakkis gsakkis at rutgers.edu
Wed Mar 23 13:52:37 EST 2005


"bruno modulix" <onurb at xiludom.gro> wrote: in message news:42413d90$0$1618$636a15ce at news.free.fr...
> Ron wrote:
> >>The problem here is that Kay's proposition mixes two points: flexible
> >>tuple unpacking and a new syntax for anonymous functions.
> >
> >
> > Yes, two different problems. I don't think anything needs to be done
> > to tuples myself.  I tend to use lists more anyway.
>
> They are two different beasts. Note that you don't have anything like
> list unpacking, now tuple unpacking is pretty common in Python (swap,
> multiple return values, formatted strings and outputs, ...).

All the following are possible:

>>> (x,y,z) = (1,2,3)
>>> (x,y,z) = [1,2,3]
>>> [x,y,z] = (1,2,3)
>>> [x,y,z] = [1,2,3]

What exactly do you mean by "don't have anything like list unpacking" ?

George





More information about the Python-list mailing list