[Python-ideas] "while:" for the loop
Chris Angelico
rosuav at gmail.com
Tue Sep 25 23:36:04 EDT 2018
On Wed, Sep 26, 2018 at 1:29 PM Mikhail V <mikhailwas at gmail.com> wrote:
>
> 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.
A comment is not better than an inline condition, no. I *want* it to
be highlighted as part of the code, not as a comment. Because it isn't
a comment - it's a loop condition.
ChrisA
More information about the Python-ideas
mailing list