Y
Hacker News
new
|
ask
|
show
|
jobs
by
switch007
3825 days ago
Or even "prettier":
x = [] if x is None else x
1 comments
knite
3825 days ago
I'm partial to:
x = x or []
link
acveilleux
3825 days ago
Only works when x is truthy for all legal x values, excluding x=0.
link
x = x or []