[Python-ideas] "while:" for the loop

Mikhail V mikhailwas at gmail.com
Tue Sep 25 23:28:18 EDT 2018


On Wed, Sep 26, 2018 at 5:38 AM Chris Angelico <rosuav at gmail.com> wrote:
>
>
> I like saying while "something": where the string describes the loop's
> real condition. For instance, while "moar data": if reading from a
> socket, or while "not KeyboardInterrupt": if the loop is meant to be
> halted by SIGINT.
>
> ChrisA

if doing so, would not it be more practical
to write is as an in-line comment then?
with new syntax it could be like this:
"""
while:  # not KeyboardInterrupt
    asd asd asd
    asd asd asd
    asd asd asd
"""
Similar effect, but I would find it better at least because it would
be highlighted as a comment and not as a string, + no quotes noise.


More information about the Python-ideas mailing list