Is it impossible to override __init__() method of classes
implemented in C (such as datetime.datetime) ?

from datetime import datetime
 class Foo(datetime):
    def __init__(self):
 obj = Foo()

Result (Python 2.7.7 and 3.4.1):

Traceback (most recent call last):
  File "", line 7, in <module>
    obj = Foo()
TypeError: Required argument 'year' (pos 1) not found

It seems to be failed to override datetime.__init__() in subclass.

makoto kuwata

Reply via email to