Is there shorthand for returning a default value if None in Python? [duplicate]
You could use the
return x or "default"
Note that this also returns
x is any falsy value, including an empty list, 0, empty string, or even