On Sat, Apr 11, 2009 at 4:44 PM, Greg Ewing
Nick Coghlan wrote:
Since the language reference is actually silent on the topic of caching the bound method when iterating over an object,
Since it's silent about that, if you write a for-loop that relies on presence or absence of cacheing behaviour, the result is undefined. The behaviour of yield-from on the same iterator would also be undefined.
It's meaningless to talk about whether one undefined construct has the same semantics as another.
But I wouldn't claim that the language reference being silent means that it's undefined. If I were asked for a clarification I would say that caching shouldn't be allowed if it changes the meaning of the program. Python in general favors *defined* semantics over leaving things in the gray. -- --Guido van Rossum (home page: http://www.python.org/~guido/)