[Python-Dev] PEP 340 - possible new name for block-statement (original) (raw)

Josiah Carlson jcarlson at uci.edu
Fri Apr 29 19:08:22 CEST 2005


Nick Coghlan <ncoghlan at gmail.com> wrote:

# Non-finalised semantics arg = None while True: try: VAR1 = next(itr, arg) except StopIteration: BLOCK2 break arg = None BLOCK1

And that bad boy should be...

     # Non-finalised semantics
     ex_block_2 = False
     arg = None
     while True:
         try:
             VAR1 = next(itr, arg)
         except StopIteration:
             ex_block_2 = True
             break
         arg = None
         BLOCK1
     if ex_block_2:
         BLOCK2

Josiah Carlson wrote:

Indeed, I also mentioned this on Wednesday.

Though I was somewhat incorrect as code examples I offered express the actual intent.



More information about the Python-Dev mailing list