Derived from the Pylint linter.
Fix is sometimes available.
This rule is unstable and in preview. The
--preview flag is required for use.
What it does#
Checks for uses of the known pre-Python 2.5 ternary syntax.
Why is this bad?#
Prior to the introduction of the if-expression (ternary) operator in Python
2.5, the only way to express a conditional expression was to use the
The if-expression construct is clearer and more explicit, and should be
preferred over the use of
or for ternary expressions.