[Python-Dev] proposal: add basic time type to the standard library

Tim Peters tim.one@comcast.net
Fri, 08 Feb 2002 15:16:33 -0500


[/F]
>     http://effbot.org/ideas/time-type.htm
>
> I can produce PEP and patch if necessary.

[Guido]
> Yes, a PEP, please!  Jim Fulton has been asking for this for a long
> time too.  His main requirement is that timestamp objects are small
> both in memory and as pickles, because Zope keeps a lot of these
> around.  They are currently represented either as long ints (with a
> little under 64 bits) or as 8-byte strings.  A dedicated timestamp
> object could be smaller than that.

Are you sure Jim is looking to replace the TimeStamp object?  All the
complaints I've seen aren't about the relatively tiny TimeStamp object, but
about Zope's relatively huge DateTime class (note that you won't have source
for that if you're looking at a StandaloneZODB checkout -- DateTime is used
at higher Zope levels), which is a Python class with a couple dozen(!)
instance attributes.  See, e.g.,

    http://dev.zope.org/Wikis/DevSite/Proposals/ReplacingDateTime

It seems clear from the source code that TimeStamp is exactly what Jim
intended it to be <wink>.

> Your idea of a base type (which presumably standarizes at least one
> form of representation) sounds like a breakthrough that can help
> satisfy different other needs.

Best I can make out, /F is only proposing what Jim would call an Interface:
the existence of two methods, timetuple() and utctimetuple().  In a comment
on his page, /F calls it an "abstract" base class, which is more C++-ish
terminology, and the sample implementation makes clear it's a "pure"
abstract base class, so same thing as a Jim Interface in the end.