On Mon, Oct 28, 2019 at 11:17 AM Andrew Barnert <abarn...@yahoo.com> wrote:
>
> On Oct 27, 2019, at 16:37, Chris Angelico <ros...@gmail.com> wrote:
> >
> > But a raise expression doesn't really make sense in that way - it
> > can't possibly have any value. It would be possible to use a raise
> > expression in a lambda function or an if/else expression, but other
> > than that, there wouldn't be much to gain.
>
> Well, also comprehensions. (And, I suppose, or/and expressions abused as 
> if/else shortcuts, but that’s even less useful than lambdas and 
> comprehensions.)
>
> But I’m not arguing that this is useful for the same reason yield_expression 
> was useful. I don’t think this is useful enough to change the language at 
> all. It’s perfectly fine that in the rare occasions when you have a good 
> reason to raise in a lambda or a comprehension, you have to define a trivial 
> one-line throw function.
>
> The point of the paragraph you’re replying to is that if I’m wrong about 
> that, and we really do need to change the language to allow raise in 
> expressions, it should be done like yield, not like print.
>

Fair point. Given the 'if', I agree with the conclusion. I'm of the
opinion that you aren't wrong about that, though, and the fact that
throw() isn't in everyone's toolkits already suggests that this really
isn't a major problem to be solved.

ChrisA
_______________________________________________
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/2IVVLXVHTSTQGTO6LP2ZTY4EOXQTPNWK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to