[Python-ideas] Introduce collections.Reiterable

Ethan Furman ethan at stoneleaf.us
Sat Sep 21 07:54:30 CEST 2013


On 09/20/2013 09:20 PM, Neil Girdhar wrote:
> I can humbly suggest why Python would deprecate the sequence protocol: there "should be one obvious way" to answer
> iter(), and in my opinion that's the  __iter__()  method.  I considered infinite iterators, and if you happen to have
>   __getitem__ written, you can trivially write an __iter__ function as follows:

1) One Obvious Way != Only One Way  (we can have both)

2) Deprecating (and removing) __getitem__ will break lots of code.  It's not going to happen.

--
~Ethan~


More information about the Python-ideas mailing list