I want to extend the datetime.date class adding it an attribute called status
that represents if the date is a work day, an administrative non-work day, courts closed day,...
I've read from How to extend a class in python?, How to extend Python class init and Chain-calling parent constructors in python, but I don't understand it well, so I'm noob with OOP.
>>> import datetime
>>> class Fecha(datetime.date):
def __init__(self, year, month, day, status):
super(Fecha, self).__init__(self, year, month, day)
self.status = status
>>> dia = Fecha(2014, 7, 14, 'laborable')
Traceback (most recent call last):
File "<pyshell#35>", line 1, in <module>
dia = Fecha(2014, 7, 14, 'laborable')
TypeError: function takes at most 3 arguments (4 given)
>>>