[issue8376] Tutorial offers dangerous advice about iterators: “__iter__() can just return self”
Amaury Forgeot d'Arc
report at bugs.python.org
Thu Jul 22 10:16:50 CEST 2010
Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:
The two example classes are used exactly the same way, and don't show the differences between them. How about a simple change like:
Replace:
"""If the class defines
:meth:`next`, then :meth:`__iter__` can just return ``self``"""
with
"""It may be convenient to define :meth:`next` in the class, and have :meth:`__iter__` just return ``self``; In this case though, the object can be iterated only once."""
----------
nosy: +amaury.forgeotdarc
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8376>
_______________________________________
More information about the Python-bugs-list
mailing list