On Sun, Oct 27, 2019, at 19:17, Andrew Barnert via Python-ideas wrote:
> On Oct 27, 2019, at 15:07, Ben Rudiak-Gould <benrud...@gmail.com> wrote:
> > 
> > throw is an expression, not a statement, in C++. I see no reason raise
> > couldn't be an expression in Python. It doesn't even need a special
> > rule in the grammar:
> > 
> >    from __future__ import raise_function
> > 
> >    foo.setParseAction(lambda a, b, c: raise(MumbleMumble()))
> 
> That’s a pretty big breaking change. Every line of code in every 
> library and app that raises would have to change to add parens. 

Could raise be made an expression without adding parens? Or, C#'s throw is 
allowed in certain specific contexts (lambda bodies and conditional 
expressions) without being a general expression. Being in the true portion of a 
conditional expression in python would require parentheses *around* the raise, 
though, e.g. (raise whatever) if condition else true.
_______________________________________________
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/GU3MMEYFOIWTUQIFGCMXVDVLEXMRWN4B/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to