[Numpy-discussion] FeatureRequest: support for array construction from iterators

Stephan Sahm Stephan.Sahm at gmx.de
Tue Dec 15 02:08:07 EST 2015


I would like to further push Benjamin Root's suggestion:

"Therefore, I think it is not out of the realm of reason that passing a
generator object and a dtype could then delegate the work under the hood to
np.fromiter()? I would even go so far as to raise an error if one passes a
generator without specifying dtype to np.array(). The point is to reduce
the number of entry points for creating numpy arrays."

would this be ok?

On Mon, Dec 14, 2015 at 6:50 PM Robert Kern <robert.kern at gmail.com> wrote:

> On Mon, Dec 14, 2015 at 5:41 PM, Benjamin Root <ben.v.root at gmail.com>
> wrote:
> >
> > Heh, never noticed that. Was it implemented more like a
> generator/iterator in older versions of Python?
>
> No, it predates generators and iterators so it has always had to be
> implemented like that.
>
> --
> Robert Kern
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20151215/1f5f9ea1/attachment.html>


More information about the NumPy-Discussion mailing list