On Wed, 18 Jan 2012 09:33:34 -0500, Neal Becker wrote: > python has builtin zip, but not unzip
That's because zip is (almost) its own inverse. > A bit of googling found my answer for my decorate/sort/undecorate > problem: > a, b = zip (*sorted ((c,d) for c,d in zip (x,y))) That does a lot of unnecessary work. a, b = zip(*sorted(zip(x,y))) > That zip (*sorted... > > does the unzipping. > > But it's less than intuitively obvious. *shrug* If you understand what zip does, it should be obvious. > I'm thinking unzip should be a builtin function, to match zip. Just create your own utility function. Not everything needs to be a built-in. def unzip(iterable): return zip(*iterable) Hardly seems worthwhile. -- Steven -- http://mail.python.org/mailman/listinfo/python-list