[Numpy-discussion] speed of array creation from tuples

2012-02-27 Thread Skipper Seabold
I am surprised by this (though maybe I shouldn't be?) It's always faster to use list comprehension to unpack lists of tuples than np.array/asarray? [~/] [1]: X = [tuple(np.random.randint(10,size=2)) for _ in range(100)] [~/] [2]: timeit np.array([x1 for _,x1 in X]) 1 loops, best of 3: 26.4

Re: [Numpy-discussion] speed of array creation from tuples

2012-02-27 Thread Keith Goodman
On Mon, Feb 27, 2012 at 2:55 PM, Skipper Seabold jsseab...@gmail.com wrote: I am surprised by this (though maybe I shouldn't be?) It's always faster to use list comprehension to unpack lists of tuples than np.array/asarray? [~/] [1]: X = [tuple(np.random.randint(10,size=2)) for _ in