[Python-ideas] ternary without else
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...
More information about the Python-ideas