from pathlib import Path

date = yes
my_path = Path(hello) / date if date else no / last

The result will be:


Where is the last go? It goes with the no. The python interpreter will consider "no" / "last" under the else condition even it actually break the syntax rule. The correct way to write the ternary operator should be:

my_path = Path(hello) / (date if date else no) / last

Now the result become: