What makes an iterator an iterator?
g.brandl at gmx.net
Wed Apr 18 13:25:45 CEST 2007
Stefan Rank schrieb:
> on 18.04.2007 07:39 Steven D'Aprano said the following:
>> I thought that an iterator was any object that follows the iterator
> replace object with "instance of a class", i.e. the relevant methods are
> looked up in the __class__ not in the instance (I think).
> I had the same troubles trying to dynamically reassign a __call__ method...
This is correct.
It's not properly documented though, and not applied consistently, e.g.
__enter__ and __exit__ are looked up in the instance itself.
More information about the Python-list