I have code that looks something like this:
x = someIntValue if y is None: y = x elif x < y: y = x
Is there a shorter way of doing this? eg, something like: y = x if x < y or not y?
y = x if x < y or not y
the issue is that y can be None and or a number
y
None
Aucun commentaire:
Enregistrer un commentaire