Skip to content

Instantly share code, notes, and snippets.

@kwatch
Last active August 29, 2015 14:03
Show Gist options
  • Save kwatch/525cee75ef89bd5dbf0b to your computer and use it in GitHub Desktop.
Save kwatch/525cee75ef89bd5dbf0b to your computer and use it in GitHub Desktop.
[python] Is it impossible to override __init__() method of classes implemented in C?
from datetime import datetime
class Foo(datetime):
def __init__(self):
datetime.__init__(self, 2014, 7, 1, 0, 0, 0)
obj = Foo()
### result:
#
# Traceback (most recent call last):
# File "hoge.py", line 7, in <module>
# obj = Foo()
# TypeError: Required argument 'year' (pos 1) not found
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment