inheriting from datetime

Grant Edwards grante at visi.com
Mon Aug 1 17:10:12 EDT 2005


On 2005-08-01, Rob Conner <rtconner at gmail.com> wrote:

> So this is simple, why can't I run the following code? I've tried many
> variances of this, but simply cannot inherit from datetime or
> datetime.datetime. I get this on line 3.
> TypeError: function takes at most 2 arguments (3 given)

I think I posted this question a while back and the problem was
that a datetime instance is not mutable, so the normal method
of deriving a class didn't work....

A quick google...

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/5f2517ecf6fb2ce/

You need to override __new__ rather than __init__

-- 
Grant Edwards                   grante             Yow!  I'm ANN LANDERS!! I
                                  at               can SHOPLIFT!!
                               visi.com            



More information about the Python-list mailing list