Re:Where are we in the Python 3 transition?
by dajonker on Friday January 01, 2016 @05:53PM
(#10823900)
That will get you into trouble as well, please use:
... etc.
[ Parent
| on HN ]
Re:Where are we in the Python 3 transition?
by switch007 on Friday January 01, 2016 @06:12PM
(#10823992)
Or even "prettier":
x = [] if x is None else x
Re:Where are we in the Python 3 transition?
by knite on Friday January 01, 2016 @06:51PM
(#10824182)
I'm partial to:
x = x or []
Re:Where are we in the Python 3 transition?
by acveilleux on Friday January 01, 2016 @08:01PM
(#10824409)
Only works when x is truthy for all legal x values, excluding x=0.