On Fri, Sep 19, 2008 at 2:50 PM, Arnar Flatberg <[EMAIL PROTECTED]>wrote:
> > > I think > [x*y for x in a for y in b] > feels pythonic, however it has a surprisingly lousy performance. > > This returns a len(x)*len(y) long list, which is not what you want. This two methods seem equivalent: In [16]: x = 100000 * [1] In [17]: y = 100000 * [2] In [18]: %timeit map(lambda a,b: a*b, x, y) 10 loops, best of 3: 31.4 ms per loop In [19]: %timeit [xx*yy for xx,yy in zip(x,y)] 10 loops, best of 3: 30.4 ms per loop L.
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion