[Python-ideas] Introduce collections.Reiterable

Ethan Furman ethan at stoneleaf.us
Sat Sep 21 08:36:57 CEST 2013


On 09/20/2013 11:21 PM, Neil Girdhar wrote:
> 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__)?

The goal of deprecation is removal.

Any item that supports index access, such as lists, tuples, and dictionaries, needs __getitem__.  Iteration is not the 
only way to access an iterable object.

--
~Ethan~


More information about the Python-ideas mailing list