"D'Arcy J.M. Cain" <da...@vex.net>: > On Sat, 23 Jul 2016 14:13:46 +0300 > Marko Rauhamaa <ma...@pacujo.net> wrote: >> I don't see an ambiguity: obviously the print call takes place after >> finishing the loop. > > It's ambiguous to the reader what was actually meant. Forcing a "pass" > there shows the reader that the empty block was not a mistake.
Just let the syntax speak for itself. The code means what the language definition says it means. >> I wonder if there is any true case of ambiguity. I guess this is all >> about an enforced aesthetic principle: GvR doesn't like the looks of >> an empty block. > > I don't think that he would be alone. Then just appeal to that subjective preference instead of some objective necessity. BTW, the standard shell requires a dummy statement in a block even though the block boundaries are clearly marked: while not quit; do done is a syntax error. This works: while not quit; do : done > If you allow empty blocks and you use it I hope that you would add a > comment so that the reader knows that you meant it. Once you learn the idioms of a language, you don't need to comment the obvious. > for x in sequence: # this is an empty block > > Is that better than "pass"? Er, in that hypothetical world, the right answer would be simply: for x in sequence: Note that I'm not arguing for the removal of "pass." I'm just saying it isn't strictly necessary. Marko -- https://mail.python.org/mailman/listinfo/python-list