KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Why I have problem creating a class inheriting from str (or also from int) class C(str): def __init__(self, a, b): str.__init__(self,a) self.b = b C("a", "B") TypeError: str() takes at most 1 argument (2 given) the same happens if I try to use int instead of str , but it works with custom classes. I need to use __new__ instead of __init__ ? why?
Tags (comma-separated)
Save Edits
Cancel