Possible Duplicate:
inheritance from str or int
Hi folks,
I'm trying to subclass the int class without any success. Here is my attempt:
class SpecialInt(int):
def __init__(self, x, base=10, important_text=''):
int.__init__(self, x, base)
self.important_text=important_text
If I perform the following:
integer = SpecialInt(123, 10, 'rage of the unicorns')
I get this error:
TypeRror: int() takes at most 2 arguments (3 given)
Any ideas? :)