[Python-Dev] Interop between datetime and mxDateTime

Guido van Rossum guido@python.org
Mon, 13 Jan 2003 21:09:00 -0500


> [Guido]
> > The proposal also recomments an abstract base type, "basetime", for
> > all time types.  Without this, cmp() is hard to do (see Tim's post for
> > explanation; we don't want datetime objects to be comparable to
> > objects with arbitrary other types, because the default comparison iss
> > meaningless).
> >
> > This could be a pure "marker" type, like "basestring".  Marc-Andre,
> > if we export basetime from the core, can mxDateTime subclass from
> > that?

[Tim]
> Let me ask a question: when I tried to make datatime.tzinfo a pure
> "marker" type, I eventually had to give up, because I absolutely
> could not make it work with pickling (and recalling that pickles
> produced by datetime.py had to be readable by datetimemodule.c, and
> vice versa).  Instead I had to make it instantiable (give it an init
> method that didn't complain), and require that tzinfo subclasses
> also have an __init__method callable with no arguments.  Are we able
> to get away with basestring because pickle already has deep
> knowledge about Python's string types?

Detail to be worked out.  If the only way to make pickling work is to
make basestring instantiable, so be it.

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