Addition of terinary operator in python

My proposal is to add the terinary operator ? to python.
How terinary works is:

x = condition ? if true : if false 

So it’s basically short for if else
Now since : has many uses in python we could perhaps use ; instead

Python already has this. It’s spelled differently: [true outcome] if [condition] else [false outcome]

3 Likes

Here are the docs for the Python conditional expression: 6. Expressions — Python 3.13.2 documentation

2 Likes

See the FAQ: