[Python-ideas] Integrate some itertools into the Python syntax

Steve Dower steve.dower at python.org
Tue Mar 22 11:29:34 EDT 2016


What if itertools.iter was added with the expanded semantics? Possibly even a new name, but similar use to the built-in func.

Top-posted from my Windows Phone

-----Original Message-----
From: "Chris Angelico" <rosuav at gmail.com>
Sent: ‎3/‎22/‎2016 6:06
Cc: "python-ideas" <python-ideas at python.org>
Subject: Re: [Python-ideas] Integrate some itertools into the Python syntax

On Tue, Mar 22, 2016 at 11:58 PM, Michel Desmoulin
<desmoulinmichel at gmail.com> wrote:
> E.G: I suggested before that iter() returns objects with advanced
> semantics for [:] as an alternative to add slicing to generators.

The builtin iter() function simply returns whatever __iter__()
returns. I've offered a way for you to easily shadow the builtin with
your own class (which can then provide whatever it likes), but it's
going to have to work by wrapping the original iterator, which will
break generators (unless you explicitly pass everything through, and
even then you'll break things that check if isinstance(x, generator),
because you can't subclass generator).

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas at python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160322/7d418211/attachment-0001.html>


More information about the Python-ideas mailing list