mercredi 8 avril 2015

Inline if expression gives unexpected return

I try to make it work:



mp = 2.5 if 'safe_mode' in options else 0.5 if 'fast_mode' in options else 1


But it returns 0 if both conditions are False, while should evaluate to 1


Aucun commentaire:

Enregistrer un commentaire