On Sat, Sep 10, 2016 at 6:01 AM, Arek Bulski <arek.bul...@gmail.com> wrote:
> Sometimes I find myself in need of this nice operator that I used back in
> the days when I was programming in .NET, essentially an expression
>
>>>> expr ?? instead
>
> should return expr when it `is not None` and `instead` otherwise.

You can use 'or' for this, as long as you're okay with other falsey
values being treated the same way. In a lot of cases, this isn't a
problem.

However, even if this is implemented, it would be in an expression
context, so 'raise' would never work. For that, I'd just use the
explicit statement form.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to