|
From: Sasha <nd...@ma...> - 2006-02-08 23:02:07
|
Array constructor does not support arbitrary iterables. For example: >>> array(iter([1,2,3])) array(<listiterator object at 0xf735c5cc>, dtype=3Dobject) In Numeric, it was not possible to try to iterate throught the object in array constructor because rank-0 arrays were iterable and would lead to infinite recursion. Since this problem was fixed in numpy, I don't see much of a problem in implementing such feature. On 2/8/06, Stephan Tolksdorf <and...@gm...> wrote: > Hi > > I'm new to Numpy and just stumbled over the following problem in Numpy > 0.9.4: > > array(x**2 for x in range(10)) > > does not return what one (me) would suspect, i.e. > > array([x**2 for x in range(10)]) > > Is this expected behavior? > > Stephan > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi= les > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat= =3D121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |