In Python, I'm trying to extend the builtin 'int' type. In doing so I want to pass in some keywoard arguments to the constructor, so I do this:
class C(int):
def __init__(self, val, **kwargs):
super(C, self).__init__(val)
# Do something with kwargs here...
However while calling C(3)
works fine, C(3, a=4)
gives:
'a' is an invalid keyword argument for this function`
and C.__mro__
returns the expected:
(<class '__main__.C'>, <type 'int'>, <type 'object'>)
But it seems that Python is trying to call int.__init__
first... Anyone know why? Is this a bug in the interpreter?