Why does __init__ not get called?
Lonnie Princehouse
finite.automaton at gmail.com
Tue Aug 9 16:08:30 EDT 2005
What kinds of illegal date values are you trying to represent? The
reason I ask is that it's not going to be as easy as subclassing
datetime... datetime is implemented in C. and so enforcement of legal
values is going to be in the C code. For the time.h functions, you're
also going to be constrained by the size of the time_t struct, which is
probably a long int on your platform. See Modules/datetimemodule.c in
the Python source.
One thing you could do would be to copy datetimemodule.c and build your
own C extension type based on it... things like MAXYEAR 9999 could be
changed that way.
The other thing would be to write a pure-python datetime class without
trying to inherit datetime.datetime.
More information about the Python-list
mailing list