[Python-Dev] Interop between datetime and mxDateTime

Fredrik Lundh fredrik@pythonware.com
Mon, 13 Jan 2003 18:41:39 +0100


guido wrote:

> There was a proposal long ago that all datetime-like objects should
> implement a timetuple() method.  Perhaps we should revive that?
> datetime does implement this.

the last revision of the "time type" proposal seems to suggest that all
time types should implement the following interface:

    tm = timeobject.timetuple()
    cmp(timeobject, timeobject)
    hash(timeobject)

and optionally

    deltaobject = timeobject - timeobject
    floatobject = float(deltaobject) # fractional seconds
    timeobject = timeobject + integerobject
    timeobject = timeobject + floatobject
    timeobject = timeobject + deltaobject

more here:

    http://effbot.org/zone/idea-time-type.htm

</F>