pythonic if else assignment