On 21.11.2014 11:26, Chris Angelico wrote:
I agree. The last example in the PEP is a cut-down form of your parser, and I raise the exact same concern:
https://www.python.org/dev/peps/pep-0479/#examples
The use of the for loop strongly implies that the loop body will be executed once for each thing in the iterable, which isn't true if you next() it in the body. Legal? Sure. Confusing? Definitely.
Yes, that example illustrates the exact same thing I tried to describe. Nice!