"GvR" == Guido van Rossum <guido@python.org> writes:
>> Container-like objects usually support protocol 1. Iterators are >> currently required to support both protocols. The semantics of >> iteration come only from protocol 2; protocol 1 is present to make >> iterators behave like sequences. But the analogy is weak -- unlike >> ordinary sequences, iterators are "sequences" that are destroyed by >> the act of looking at their elements. GvR> (I could do without the last sentence, since this expresses a GvR> value judgement rather than fact -- not a good thing to have GvR> in a PEP's "specification" section.) What about: "...sequences. Note that the act of looking at an iterator's elements mutates the iterator." -Barry