class TitledText(str):
def __new__(cls, content, text_title, *args, **kwargs):
instance = super().__new__(cls, content, text_title)
return instance
def title(self):
return self._text_title
titled = TitledText('Сreate a class Soda', 'Homework')
print(titled)
Почему выдаёт ошибку?
def __new__(cls, content, text_title, *args, **kwargs):
instance = super().__new__(cls, content, text_title)
return instance
def title(self):
return self._text_title
titled = TitledText('Сreate a class Soda', 'Homework')
print(titled)
Почему выдаёт ошибку?