​​
[ this
​request
/discussion refers to numpy issue
​​
​​
#5863
​ ​
​​
https://github.com/numpy/numpy/pull/5863#issuecomment-159738368 ]


Dear all,

As far as I can think, the expected functionality of np.array(...) would be np.array(list(...)) or something even nicer.
Therefore, I like to request a generator/iterator support for np.array(...) as far as list(...) supports it.


A more detailed reasoning behind this follows now.

In general it seems possible to identify iterators/generators as needed for this purpose: - someone actually implemented this feature already (see
​​
​​
#5863
) - there is ​``type.GeneratorType​`` and ​``​collections.abc.Iterator​`` for ``isinstance​(...)`` check ​- numpy can destinguish them already from all other types which get well translated into a numpy array​ ​
Given this, I think the general argument goes roughly like the following:
PROS (effect maybe 10% of numpy user or more): - more intuitive overall behaviour, array(...) = array(list(...)) roughly - python3 compatibility (see e.g. #5951) - compatibility with analog ``__builtin__`` functions (see e.g. #5756) - all the above make numpy easier to use in an interactive style (e.g. ipython --pylab) (computation not that important, however coding time well) CONS (effect less than 0.1% numpy user I would guess): - might break existing code
which in total, at least for me at this stage, speaks in favour of merging
​ ​
​the already existing
​featurebranch (see
​​
​​
#5863
​) 
or something similar into numpy master
​.

Discussion, please!
​cheers,
Stepha​n