Noah wrote:
> def unzip(list):
>     if len(list) == 0: return ()
>     l = []
>     for t in range(len(list[0])):
>         l.append(map( lambda x,t=t: x[t], list ))
>     return tuple(l)

The simplest solution to this problem that I know of:

     def unzip(iterable):
         return zip(*iterable)

However, Guido feels that this is an abuse of the argument passing 
machinery.  For a version that is a little more careful in the case of 
iterables, see:

     http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302325

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

Reply via email to