There is the conditional expression:
a if cond else b
but this is an expression, not a statement.
In if statements, the if
(or elif
or else
) can be written on the same line as the body of the block if the block is just one like:
if something: somefunc()
else: otherfunc()
but this is discouraged as a matter of formatting-style.