[Numpy-discussion] numpy.asarray( iterator )

Sebastian Haase haase@msg.ucsf....
Mon Feb 4 07:56:54 CST 2008


Can this be changed:
If I have a list L the usual N.asarray( L )  works well -- however I
just discovered that N.asarray( reversed( L ) )  breaks my code....

Apparently reversed( L ) returns an iterator object, and N.asarray(
reversed( L ) )   (called arrY in my function)
results in:
(Pdb) p arrY
array(<listreverseiterator object at 0x1a508a90>, dtype=object)
(Pdb) p arrY.shape

Comments ?   How about letting asarray call fromiter  when it sees
that the argument is a iterator !?

Sebastian Haase

More information about the Numpy-discussion mailing list