[issue18558] Iterable glossary entry needs clarification

R. David Murray report at bugs.python.org
Thu Aug 1 22:26:32 CEST 2013


R. David Murray added the comment:

That would give you a false positive, though.  It would return True for the 'y' in my example, which is not iterable.  So Iterable's behavior here is an example of the Python design rule "resist the temptation to guess".

As Terry said, new classes should implement an __iter__ method.  The __getitem__ iteration support is for backward compatibility.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18558>
_______________________________________


More information about the Python-bugs-list mailing list