[Python-ideas] Introduce collections.Reiterable

Neil Girdhar mistersheik at gmail.com
Sat Sep 21 08:21:21 CEST 2013


No one suggested removing __getitem__.  Some people have suggested
deprecating (without removing) the sequence protocol.  Do you know of any
object that relies on the sequence protocol?  That is, that implements
__getitem__ without implementing __iter__ (or using a mixin like
collections.Sequence to provide __iter__)?


On Sat, Sep 21, 2013 at 1:54 AM, Ethan Furman <ethan at stoneleaf.us> wrote:

> 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~
>
> ______________________________**_________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/**mailman/listinfo/python-ideas<https://mail.python.org/mailman/listinfo/python-ideas>
>
> --
>
> --- You received this message because you are subscribed to a topic in the
> Google Groups "python-ideas" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/**
> topic/python-ideas/**OumiLGDwRWA/unsubscribe<https://groups.google.com/d/topic/python-ideas/OumiLGDwRWA/unsubscribe>
> .
> To unsubscribe from this group and all its topics, send an email to
> python-ideas+unsubscribe@**googlegroups.com<python-ideas%2Bunsubscribe at googlegroups.com>
> .
> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130921/e52a6452/attachment.html>


More information about the Python-ideas mailing list