
April 25, 2005
2:38 p.m.
"Nick Coghlan" <ncoghlan@gmail.com> wrote in message news:426CB7C2.8030508@gmail.com...
Guido van Rossum wrote:
statement expansion", I think we can expect EXPR to produce a value that is already an iterator (rather than merely an interable).
Not supporting iterables makes it harder to write a class which is inherently usable in a with block, though. The natural way to make iterable classes is to use 'yield' in the definition of __iter__ - if iter() is not called, then that trick can't be used.
Would not calling iter() (or .__iter__) explicitly, instead of depending on the implicit call of for loops, suffice to produce the needed iterator? tjr