On Thu, 14 Nov 2019 at 16:42, Random832 <random...@fastmail.com> wrote:
> So, uh... what if we didn't need backslashes for statements that begin with a > keyword and end with a colon? There's no syntactic ambiguity there, right? > Honestly, adding this would make me less annoyed with the error I get when I > forget the colon, since it'd actually have a purpose other than grit on the > screen. Not sure about ambiguity, but it would require a much more powerful parser than Python currently has (which only looks ahead one token). Guido is experimenting with PEG parsers, so maybe it will be a possibility in the future, but right now the current parser can't handle it (yes, there are hacks for some special constructs already, but this would need *arbitrary* lookahead - you could have many lines between the with and the colon). Also, I suspect it would really screw up error reporting: with open(fname1) as f1, open(fname2) as f2, open(fname3) as f3, open(fname4) as f4, # Whoops, comma instead of colon print(hello) import xxx as bar if some_var > 10: return Computer parsers are far dumber than human brains, and if I looked at that without having written it, *I'd* have trouble working out what was wrong, so the poor computer has no chance! Paul _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/ISE5PP65ROECCKWGPMASEP5WIJ6QNYPL/ Code of Conduct: http://python.org/psf/codeofconduct/