[docs] possible bug in Python tutorial sect 9.9

Georg Brandl georg at python.org
Mon Jul 19 14:26:01 CEST 2010


Am 19.07.2010 11:37, schrieb Nicholas Cameron:
> Hi, there is either a bug or scope for some extra clarity in the 
> iterators section of the Python tutorial:
> 
> http://docs.python.org/tutorial/classes.html#iterators
> 
> The docs state that the method used to get an iterator for an object is 
> iter() (after the first example in the section), but after the second 
> example, uses __iter__(). I'm new to Python so not sure if either is 
> correct and the other incorrect or if the syntax changes when 
> implementing the method yourself, I guess some clarification would help 
> if it is the latter case.

Hi Nick,

yes, the latter is indeed the case.  I've added a line now to the example
for the class defining __iter__() that shows that calling iter() works
on it.

regards,
Georg


More information about the docs mailing list