I am defining a Python Holiday
class and three subclasses: one for fixed date holidays, a second for relative holidays, and a third for floating Monday holidays. I would like to create a set of constants in the superclass Holiday
so that applications can simply refer to particular holidays as
Holiday.NEW_YEARS
Holiday.CHRISTMAS
etc.
but the subclasses obviously do not exist when the parent class is instantiated. How can I do this?
class Holiday(object):
NEW_YEARS = FixedHoliday(1, 1)
MLK_BIRTHDAY = FloatingMonday(1, 15)
...