I come from c/c++ and I like my ternary operator. Simply great for short and simple condition-assignment.
Since i’ve started using python (about 18 months), I have problems remembering the proper way to do this (ADD anyone ?), simply because Guido went for a “great to read” but “impossible to think” way of expressing it.
So here’s for me and others to remember (I’ve also put it on a huge post-it above my desk) :
c version is –> conditionalExpression ? valueIfTrue :valueifFalse;
python version is –> valueIfTrue if conditionalExpression else valueifFalse