Overloading Str In Python
I have code that looks like the following: class C(str): def __init__(self, a, b): print('init was called!') super().__init__(b) self.a = a c = C(12,
Solution 1:
I'm not sure why you're getting the specific error you're getting, but in any case you will need to override __new__
as well as __init__
.
Post a Comment for "Overloading Str In Python"