Datetime question
Rama
ramasubramani.g at gmail.com
Thu Aug 3 09:45:55 EDT 2006
>
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060803/ca8a35d8/attachment.html>
More information about the Python-list
mailing list