On Thu, Nov 14, 2019, at 11:54, Paul Moore wrote: > On Thu, 14 Nov 2019 at 16:42, Random832 <[email protected]> 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).
Would it? I was thinking it could be the same as parentheses (or inside list/dict/set displays) - it sees the keyword (with, if, for), and now it is in a mode where whitespace does not matter, until it reaches the colon. > 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). but there's no construct that begins with 'with' and *doesn't* end in a colon. _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/57VUALC3NBJNX3ZDHEBCPEHX647BGHS7/ Code of Conduct: http://python.org/psf/codeofconduct/
