Little bit of Python Zen - ternary

home | blog | Terrible people and places | Covid-19 links | Teh Internet | guest blog |rants | placeholder | political | projects | Gwen and Liam | Citadel patched | Tools | Scouts

Looks nice:
 z = a if a > b else b

Came across it here:

Compare to PHP
$action = (empty($_POST['action'])) ? 'default' : $_POST['action'];

Looks like the Ruby folks learned syntax from either PHP or Sinclair
no intended slam on Sinclair Research, as they used the ? to a great
end in that it was such a help in line edits in their basic
a feat that has still not been accomplished in either VI or EMACS!

Sorry for the rant, here is the Ruby pseudo-code
test-expression ? if-true-expression : if-false-expression

Which one reads faster?