datetime objects are immutable. You can't change the value of an
existing datetime object, only create a new one.
 
 
Um.. then how do I get the same ID when I call the replace method?
 
 
>>> a = datetime.datetime(2006, 8, 12, 10, 13, 56, 609000)
>>> b = a + datetime.timedelta(days=-2, hours=-4)
>>>
>>>
>>> id(a)
21838592
>>> id(b)
21836312
>>> a.replace(day=a.day + 1)
datetime.datetime(2006, 8, 13, 10, 13, 56, 609000)
>>> id(a)
21838592
>>>
 
thanks,
Rama
 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to