The voodoo of zip(*someList)

Message Drop Box mdrop1 at yahoo.com
Mon Aug 30 04:00:13 EDT 2004


All,

How (and why) does zip(*someList) work? 

>>> s = [[1, 2, 3], ['one', 'two', 'three'], ['I', 'II', 'III']]
>>> zip(*s)
[(1, 'one', 'I'), (2, 'two', 'II'), (3, 'three', 'III')]

I've never seen the star '*' outside of function/method definitions
and I've looked in the Python documentation without success. This
syntax is voodoo to me at the moment. I'm stumped.

Thanks,
Stuart



More information about the Python-list mailing list