Jak rozszerzyć klasę init Pythona
Stworzyłem klasę bazową:
class Thing():
def __init__(self, name):
self.name = name
Chcę rozszerzyć klasę i dodać dow tym metoda tak, żeSubThing
ma zarówno aname
i atime
własność. Jak mam to zrobić?
class SubThing(Thing):
# something here to extend the init and add a "time" property
def __repr__(self):
return '<%s %s>' % (self.name, self.time)
Każda pomoc byłaby niesamowita.