I have some trouble understanding what happens with class init arguments that are lists
like:
class A(object):
def __init__(self, argument=[]):
self.argument = argument[:]
or:
def __init__(self,argument=None):
self.arguments = arguments or []
or:
def __init__(self, argument=[]):
self.argument = argument
This can't be done because the default value for every A
object would point to the same piece of memory. I can't really understand what happens here and how it happens.