There's got to be something simple I'm missing... You obviously can't do a < b ? a : b and this a if a < b else b is a syntax error. I started playing with lambda functions but I didn't have any luck there either.