I wrote: > __iter__ is a red herring. [...blah blah blah...] > The short of it is that whenever any Python programmer says > "for x in y", he or she had better be darned sure of whether > this is going to destroy y. Whatever we can do to make this > clear would be a good idea. Guido wrote: > This is a very good summary of the two iterator protocols. Ping, > would you mind adding this to PEP 234? And i thought it was a critique. Fascinating, Captain. :) I'm happy to add the text, but i want to be clear, then: is it acceptable to write an iterator that only provides <next> if you only care about the "iteration protocol" and not the "for-able protocol"? I see that "ought to" is the most opinion the PEP is willing to give on the topic: A class is a valid iterator object when it defines a next() method that behaves as described above. A class that wants to be an iterator also ought to implement __iter__() returning itself. -- ?!ng
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4