[Python-Dev] PEP 548: More Flexible Loop Control

R. David Murray rdmurray at bitdance.com
Tue Sep 5 20:11:00 EDT 2017


I've written a PEP proposing a small enhancement to the Python loop
control statements.  Short version: here's what feels to me like a
Pythonic way to spell "repeat until":

    while:
        <do stuff>
        break if <done condition>

The PEP goes into some detail on why this feels like a readability
improvement in the more general case, with examples taken from
the standard library:

     https://www.python.org/dev/peps/pep-0548/

Unlike Larry, I don't have a prototype, and in fact if this idea
meets with approval I'll be looking for a volunteer to do the actual
implementation.

--David

PS: this came to me in a dream on Sunday night, and the more I explored
the idea the better I liked it.  I have no idea what I was dreaming about
that resulted in this being the thing left in my mind when I woke up :)


More information about the Python-Dev mailing list