[Python-ideas] ternary without else

Kirill Balunov kirillbalunov at gmail.com
Fri May 25 08:26:06 EDT 2018

2018-05-25 13:06 GMT+03:00 Jacco van Dorp <j.van.dorp at deonet.nl>:

> [...]
> I would very much like to write:
> >>> do_something if cond
> and be done with it. Like a ternary expression but without the else clause.
If it is an expression, what should `do_something if cond` return on
failure? If you don't care you can already use `cond and do_something`.

With kind regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180525/97b3c64c/attachment-0001.html>

More information about the Python-ideas mailing list