by capableweb · 3y ago · 0 comments
[] + []
{} + {}
[] + {}
{} + []
Great examples :)The point is not what the data or naming of the functions/variables is, but what's happening when you run it...
Hint: list.append(value) returns None
But wanting to provide default values of [] is quite common in Python. Seeing this workaround is quite common in Python:
def func(arg=None):
if arg is None:
arg = []
...