def my_func(working_list=None): if working_list is None: working_list = [] # alternative: # working_list = [] if working_list is None else working_list working_list.append("a") print(working_list) The docs say you should use None as the default and explicitly test for ittest for it in the body of the function.
Aside
x is None is the comparison recommended by PEP 8:
Comparisons to singletons like None should always be done with
isoris not, never the equality operators.Also, beware of writing
if xwhen you really meanif x is not None[...]
See also What is the difference between "is None" and "== None"