[Python-Dev] functions exposed by datetime

Guido van Rossum guido@python.org
Wed, 15 Jan 2003 15:51:34 -0500


> The more I read about "datetime", I am beginning to realize that like
> "mxDateTime", it is a needlessly awkward to use for people who want to
> cheaply turn a calendar date into a 32 bit integer, and back again.

Is the following really too awkward?

>>> from datetime import *
>>> a = date.today()
>>> b = date(1956, 1, 31)
>>> a-b 
datetime.timedelta(17151)
>>> (a-b).days
17151
>>> 

--Guido van Rossum (home page: http://www.python.org/~guido/)