Yeah, it's a nasty trap that one. I think there are linters that can spot it these days. The correct pattern looks like this: def my_function(a, b=None): b = b or [] … Or this if you want to support false-y values being passed for b: b = [] if b is None else b