class Test(object):
def __init__(value, create_datetime=datetime.utcnow()):
self.value = value
self.create_datetime = create_datetime
class Test(object):
def __init__(value):
self.value = value
self.create_datetime = datetime.utcnow()
class Test(object):
def __init__(value, create_datetime=datetime.utcnow()):
self.value = value
self.create_datetime = create_datetime
class Test(object):
def __init__(value):
self.value = value
self.create_datetime = datetime.utcnow()
victor_krТочно.
В первом случае у всех объектов Test значение create_datetime - одинаковое и, похоже, равно времени загрузки модуля!
victor_krhttp://docs.python.org/tutorial/controlflow.html#default-argument-values
Почему?! Где об этом прочитать?