Matt Nordhoff wrote:
[snip]

> 
> As Paddy wrote, zip is its own unzip:
> 
>>>> zipped = zip((1, 2, 3), (4, 5, 6))
>>>> zipped
> [(1, 4), (2, 5), (3, 6)]
>>>> unzipped = zip(*zipped)
>>>> unzipped
> [(1, 2, 3), (4, 5, 6)]
> 
> Neat and completely confusing, huh? :-)
> 
> <http://paddy3118.blogspot.com/2007/02/unzip-un-needed-in-python.html>

I hadn't thought about zip() being symmetrical like that.  Very cool...

Rich
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to