4 ms·
That will get you into trouble as well, please use: if x is None: x = [] ... etc.
by dajonker 11y ago
That will get you into trouble as well, please use:
if x is None:
x = []
... etc.
- switch007 11y agoOr 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.