4 ms·
def f(x=None): x = x if x is not None else [] return x Now it will assign that value back to x. Otherwise it would just evaluate the expression
by coderdude 14y ago
def f(x=None):
x = x if x is not None else []
return x
Now it will assign that value back to x. Otherwise it would just evaluate the expression.
- chernevik 14y agoThanks for the additional clarity.