[Python-ideas] __iter__ implies __contains__?
Raymond Hettinger
raymond.hettinger at gmail.com
Tue Oct 4 04:54:02 CEST 2011
On Oct 3, 2011, at 3:22 AM, Greg Ewing wrote:
> Passing non-reiterable objects around is not something that
> I think should be encouraged.
Really? Passing around iterators is a basic design pattern
http://en.wikipedia.org/wiki/Iterator_pattern for lots of languages.
You may have a personal programming style that avoids
iterators, but that shouldn't be forced on the rest of the community.
The only way for a broad categories of iterators to become
reiterable is for their outputs to be stored in memory (thus
defeating the just-in-time memory conserving property of
many iterators).
Raymond
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20111003/6d96c30e/attachment.html>
More information about the Python-ideas
mailing list