Y
Hacker News
new
|
ask
|
show
|
jobs
by
dajonker
3825 days ago
That will get you into trouble as well, please use:
if x is None: x = []
... etc.
1 comments
switch007
3825 days ago
Or even "prettier":
x = [] if x is None else x
link
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