[Python-ideas] Syntax: 'return: ...' expressions

Chris Angelico rosuav at gmail.com
Mon Jan 5 10:55:41 CET 2015


On Mon, Jan 5, 2015 at 8:49 PM, Andrew Barnert
<abarnert at yahoo.com.dmarc.invalid> wrote:
> Finally, are you sure your new return: isn't ambiguous without look ahead or context? When the parser reads "if spam: return", is it starting a return simple statement, or an expression statement that starts with a return expression? Have you tried actually writing out the grammar?
>

The way I see it, the return-expression is "return:", whereas the
simple return statement would have no colon. Your other concerns,
though, are quite valid.

ChrisA


More information about the Python-ideas mailing list