This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients bruth, rhettinger
Date 2013-03-31.19:39:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1364758754.22.0.721219619758.issue17584@psf.upfronthosting.co.za>
In-reply-to
Content
It's the nature of duck typing in a dynamic language.  You can tell whether something is present but can't tell whether it words correctly until you call it.

For example, in Python 3, all objects have __lt__ defined, but all it does is return NotImplemented.  So, you can't really tell whether something is orderable until you make the less-than call.

In your case, the rule is that if "next" is present, we assume that it is iterable, but it won't be until it is called that we can tell whether it is implemented correctly (i.e. is callable with zero arguments, returns a value, and raises StopIteration when done).
History
Date User Action Args
2013-03-31 19:39:14rhettingersetrecipients: + rhettinger, bruth
2013-03-31 19:39:14rhettingersetmessageid: <1364758754.22.0.721219619758.issue17584@psf.upfronthosting.co.za>
2013-03-31 19:39:14rhettingerlinkissue17584 messages
2013-03-31 19:39:14rhettingercreate