[Python-ideas] PEP 315: do-while

Łukasz Langa lukasz at langa.pl
Wed Jun 26 10:47:39 CEST 2013


The PEP is deferred because it seems that

  while True:
    <code>
    if condition:
      break

is good enough. I agree. We should reject the PEP and summarise
the status. Alternatively, the only way I think we can improve on
the syntax above is something like this:

  do:
    <code>
    if condition:
      break

or without a new keyword:

  while:
    <code>
    if condition:
      break

The empty-predicate variant would let Python check whether there's
actually a break in the body of the loop.

-- 
Best regards,
Łukasz Langa

WWW: http://lukasz.langa.pl/
Twitter: @llanga
IRC: ambv on #python-dev



More information about the Python-ideas mailing list