On Friday 19 July 2002 12:26 am, Tim Peters wrote:
"...sequences. Note that the act of looking at an iterator's elements mutates the iterator."
That doesn't belong in the spec either -- nothing requires an iterator to have mutable state, let alone to mutate it when next() is called.
Right, for unbounded iterators returning constant values, such as:
class Ones: def __iter__(self): return self def next(self): return 1
However, such "exceptions that prove the rule" are rare enough that I wouldn't consider their existence as forbidding to say _anything_ about state mutation. I _would_ similarly say that x[y]=z normally mutates x, even though "del __setitem__(self, key): pass" is quite legal. Inserting an adverb such as "generally" or "usually" should suffice to make even the most grizzled sea lawyer happy while keeping the information in.