Y
Hacker News
new
|
ask
|
show
|
jobs
by
tomchristie
2867 days ago
It’s okay-ish. You do need to be careful about what falsey values `x` might be tho, as it could introduce edge-case bugs.
Using `x = [] if x is None else x` is more precise.
1 comments
Asooka
2867 days ago
I would really just write `if x is None: x = []`
link