Oliver Eichler a écrit :
Diez B. Roggisch wrote:


zip(*[(1,4),(2,5),(3,6)])


Thanks :) I knew it must be simple. The asterics - thing was new to me.


By the way: What is faster?

this:

z = [(1,4),(2,5),(3,6)
a,b = zip(*[(x[0], x[0]-x[1]) for x in z])

or:

a = []
b = []
for x in z:
  a.append(x[0])
  b.append(x[0]-x[1])

I guess first, isn't it?


Oliver

Best answer is : try it :) use the "timeit" module (in the standard lib) to do so ...

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

Reply via email to