[Python-ideas] Introduce collections.Reiterable

Terry Reedy tjreedy at udel.edu
Sat Sep 21 01:59:25 CEST 2013

On 9/20/2013 5:48 PM, Raymond Hettinger wrote:
> On Sep 20, 2013, at 2:15 PM, Terry Reedy
> <tjreedy at udel.edu
> <mailto:tjreedy at udel.edu>> wrote:
>> . The glossary might say that the older __getitem__ protocol is
>> semi-deprecated (it is no longer used directly) but is adapted for
>> back compatibility.
> It is NOT deprecated.

And I did not suggest that is was. It is, however, not fully supported 
in that collections. Iterable does not recognize __getitem__ iterables 
and the same will be true of code that uses Iterable.

 > People use and rely on this behavior.

Are people still writing fake __getitem__ methods? (that are really next 
methods rather than random access methods).  It believe that usage of 
the protocol to be informally deprecated in favor of __iter__ and __next__.

Terry Jan Reedy

More information about the Python-ideas mailing list