Efficiently Split A List of Tuples

Ron Adam rrr at ronadam.com
Mon Jul 18 21:21:04 CEST 2005

Simon Dahlbacka wrote:

> Oooh.. you make my eyes bleed. IMO that proposal is butt ugly (and
> looks like the C++.NET perversions.)

I haven't had the displeasure of using C++.NET fortunately.

    point = [5,(10,20,5)]

    size,t = point
    x,y,z = t

    size,x,y,z = point[0], point[1][0], point[1][1], point[1][2]

    size,x,y,z = point[0], ^point[1]    # Not uglier than the above.

    size,(x,y,z) = point                # Not as nice as this.

I forget sometimes that this last one is allowed, so ()'s on the left of 
the assignment is an explicit unpack.  Seems I'm tried to reinvent the 
wheel yet again.


More information about the Python-list mailing list