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

Chris Angelico rosuav at gmail.com
Mon Mar 21 20:02:20 EDT 2016


On Tue, Mar 22, 2016 at 10:59 AM, Michel Desmoulin
<desmoulinmichel at gmail.com> wrote:
> The solution I'm currently using involves having a class called g, and
> everytime I want to manipulate an iterable, I just wrap it in g().
>
> Then I got an object with all those semantics (and actually a lot more).
>
> Maybe we can make only those things apply to the objects returned by
> iter() ?

Oh, that's easy then.

iter = g

:)

> (Also, about slicing accepting callable, actually g() goes a bit
> overboard and accept any object. If the object is not an int or
> callable, then it's used as a sentinel value. Not sure if I should speak
> about that here.)

Nothing wrong with that. The semantics are still the same; you simply
have several ways of defining "the end has been reached".

ChrisA


More information about the Python-ideas mailing list