[Python-Dev] Documentation Error for __hash__
Terry Reedy
tjreedy at udel.edu
Thu Aug 28 23:55:14 CEST 2008
Jeff Hall wrote:
> I'm not sure about the first but as for the __reversed__ we had a
> discussion yesterday and it was indeed added in 2.4 (oddly, my 2.5
> documentation has this correct... )
2.4 doc:
reversed( seq)
Return a reverse iterator. seq must be an object which supports the
sequence protocol (the __len__() method and the __getitem__() method
with integer arguments starting at 0). New in version 2.4.
[no mention of __reversed__]
3.3.6 Additional methods for emulation of sequence types
[ditto]
However, I confirmed that __reversed__ is used by reverse()
class C:
def __reversed__(self): return 'abc'
c=C()
print(reversed(c))
>>>
abc
More information about the Python-Dev
mailing list