On Mon, May 15, 2017 at 7:38 PM, Hugh Fisher <hugo.fis...@gmail.com> wrote: > I wrote this little Python program using CPython 3.5.2. It's ... > interesting ... that we apparently don't need comments or pass > statements any more. Anyone else think it might be worth tightening up > the grammar definition and parser a bit? >
Nope. For starters, you shouldn't be using "pass" statements OR dummy strings to fill in an if statement's body; you can instead simply write: if x <= 0: x += 1 Or worst case: if not (x > 0): x += 1 For the rest, all you've shown is that trivial expressions consisting only of string literals will be ignored in certain contexts. The trouble is that string literals don't really mean comments, and won't be ignored by most humans; plus, there are contexts where they are not ignored. Here, rewrite this without comments: wrong_answer_messages = [ "Wrong.", "Totally wrong, you moron.", "Bob, you idiot, that answer is not right. Cordially, Ted.", # Maize "That's as useful as a screen door on a battleship.", # BTTF # etc ] String literals won't work here, and even if they did, they would be _extremely_ confusing. Comments are semantically distinct. The 'pass' statement has a very specific meaning and only a few use-cases. It could often be omitted in favour of something else, but there's not a lot of value in doing so. Comments have very significant value and should definitely be kept. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/