do:
thing()
thing()
continue if condition
And you can now express "skip ahead" with a `break if X` as well. do:
thing()
thing()
if condition:
continue x = 0
do:
x += 1
while:
x < 10 do:
body()
body()
while x < 10
It's just a compound statement consumes the trailing while clause.Decorators already precede a function (or class) definition[2], and one alternative for the ill-fated switch statement[1] was to have switch precede the case blocks to avoid excessive indentation.
So there's plenty of precedent in the other direction.
[1]: https://www.python.org/dev/peps/pep-3103/#alternative-3
(Edit: Actually, I think I know what you were saying now, and those aren't quite the same thing as they need a line after them.)
I do think the condition on the next line isn't the way to do solve this problem though (and I don't think it needs solving, while True: ... if ...: break does the job).
But I don't think having it all on one line would be that bad.