5 ms·
Or even "prettier": x = [] if x is None else x
by switch007 11y ago
Or even "prettier":
x = [] if x is None else x
- knite 11y agoI'm partial to: x = x or []
- acveilleux 11y agoOnly works when x is truthy for all legal x values, excluding x=0.