[Python-Dev] PEP 340 - possible new name for block-statement
Guido van Rossum
gvanrossum at gmail.com
Fri Apr 29 07:27:26 CEST 2005
> Far too close to the "for" loop, IMHO. I read that, I'd have to remind
> myself every time, "now, which one is it that can receive values passed
> back in: for ... in, or in ... for?"
Whoa! Read the PEP closely. Passing a value back to the iterator
(using "continue EXPR") is supported both in the for-loop and in the
block-statement; it's new syntax so there's no backwards compatibility
issue. The real difference is that when a for-loop is exited through a
break, return or exception, the iterator is left untouched; but when
the same happens in a block-statement, the iterator's __exit__ or
__error__ method is called (I haven't decided what to call it).
> Another possibility just occurred to me. How about "using"?
Blah. I'm beginning to like block just fine. With using, the choice of
word for the generator name becomes iffy IMO; and it almost sounds
like it's a simple renaming: "using X as Y" could mean "Y = X".
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev