<div dir="ltr"><font face="tahoma, sans-serif"><div class="gmail_default" style="color:rgb(0,0,0);display:inline">​​</div>[ this <div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0);display:inline">​request</div>/discussion refers to numpy issue <a><div class="gmail_default" style="color:rgb(0,0,0);display:inline">​​</div><div class="gmail_default" style="color:rgb(0,0,0);display:inline">​​</div>#5863</a><div class="gmail_default" style="color:rgb(0,0,0);display:inline">​ ​</div><div class="gmail_default" style="color:rgb(0,0,0);display:inline">​​</div><a href="https://github.com/numpy/numpy/pull/5863#issuecomment-159738368" target="_blank">https://github.com/numpy/numpy/pull/5863#issuecomment-159738368</a> ]</font><div><font face="tahoma, sans-serif"><br></font></div><div><font face="tahoma, sans-serif"><br></font></div><div><div class="gmail_default"><font face="tahoma, sans-serif" color="#000000">Dear all,</font></div><div class="gmail_default"><font face="tahoma, sans-serif" color="#000000"><br></font></div><div class="gmail_default"><font face="tahoma, sans-serif" color="#000000"><span style="line-height:22.4px">As far as I </span></font><font face="tahoma, sans-serif" color="#000000">can think, the expected functionality of np.array(...) would be np.array(list(...)) or something even nicer.<br>Therefore, I like to request a generator/iterator support for np.array(...) as far as list(...) supports it.</font></div><div class="gmail_default"><br></div><div class="gmail_default"><span style="line-height:22.4px;color:rgb(0,0,0);font-family:tahoma,sans-serif"><br></span></div><div class="gmail_default"><font face="tahoma, sans-serif" color="#000000"><span style="line-height:22.4px">A more detailed reasoning behind this follows now.</span></font></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div class="gmail_default"><br></div></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_default"><font color="#000000"><span style="font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';line-height:21px;white-space:pre-wrap">In general it seems possible to identify iterators/generators as needed for this purpose:
- someone actually implemented this feature already (see </span><a href="https://mail.google.com/mail/u/0/%E2%80%8Bhttps://github.com/numpy/numpy/pull/5863#issuecomment-159738368" style="font-family:tahoma,sans-serif" target="_blank"><div class="gmail_default" style="display:inline">​​</div><div class="gmail_default" style="display:inline">​​</div>#5863</a>)<span style="font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';line-height:21px;white-space:pre-wrap">
- 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​
​</span></font></div></blockquote><font color="#000000"><span style="font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';line-height:21px;white-space:pre-wrap">Given this, I think the general argument goes roughly like the following:</span><br></font><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_default"><font color="#000000"><span style="font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';line-height:21px;white-space:pre-wrap">
PROS (effect maybe 10% of numpy user or more):
- more intuitive overall behaviour, array(...) = array(list(...)) roughly
- python3 compatibility (see e.g. </span><a href="https://github.com/numpy/numpy/issues/5951" title="Support zip input in savetxt in Python 3" style="text-decoration:none;font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';line-height:21px;white-space:pre-wrap" target="_blank">#5951</a><span style="font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';line-height:21px;white-space:pre-wrap">)
- compatibility with analog ``__builtin__`` functions (see e.g. </span><a href="https://github.com/numpy/numpy/issues/5756" title="numpy.all may return a generator, which always evals to True" style="text-decoration:none;font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';line-height:21px;white-space:pre-wrap" target="_blank">#5756</a><span style="font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';line-height:21px;white-space:pre-wrap">)
- 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
<br></span></font></div></blockquote><font color="#000000"><span style="font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';line-height:21px;white-space:pre-wrap">which in total, at least for me at this stage, speaks in favour of merging<div class="gmail_default" style="font-family:tahoma,sans-serif;display:inline">​ ​</div></span><span style="font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';line-height:21px;white-space:pre-wrap"><div class="gmail_default" style="font-family:tahoma,sans-serif;display:inline">​the already existing</div> <div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0);display:inline">​featurebranch (see</div> <div class="gmail_default" style="font-family:tahoma,sans-serif;display:inline">​</div></span><a href="https://mail.google.com/mail/u/0/%E2%80%8Bhttps://github.com/numpy/numpy/pull/5863#issuecomment-159738368" style="font-family:tahoma,sans-serif" target="_blank"><div class="gmail_default" style="display:inline">​​</div><div class="gmail_default" style="display:inline">​​</div>#5863</a><div class="gmail_default" style="font-family:tahoma,sans-serif;display:inline">​) </div><span style="font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';line-height:21px;white-space:pre-wrap"><div class="gmail_default" style="font-family:tahoma,sans-serif;display:inline">​</div>or something similar into numpy master<div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0);display:inline">​.</div></span></font><div><font color="#000000" face="tahoma, sans-serif"><span style="line-height:21px;white-space:pre-wrap"><br></span></font></div><div><font color="#000000" face="tahoma, sans-serif"><span style="line-height:21px;white-space:pre-wrap"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0);display:inline">Discussion, please!</div></span></font></div><div><font color="#000000" face="tahoma, sans-serif"><span style="line-height:21px;white-space:pre-wrap"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0);display:inline">​cheers,</div></span></font></div><div><font color="#000000" face="tahoma, sans-serif"><span style="line-height:21px;white-space:pre-wrap"><div class="gmail_default" style="font-family:tahoma,sans-serif;color:rgb(0,0,0);display:inline">Stepha​n</div><br></span></font><div><div class="gmail_default"><br></div></div></div></div>