If I want to make a base class that other classes will inherit from, but will never use the class variables from, what should I set the class variables to?
For example:
class Spam:
time_to_cook = None
def eat(self):
...
class SpamWithEggs(Spam):
time_to_cook = Minutes(5)
def eat(self):
...
All subclasses will have their own time_to_cook
, so its value in Spam
has no effect on the functioning of the program.
class Spam:
time_to_cook = None
looks good to me, but it doesn't give any information about the type of time_to_cook
. Therefore I'm leaning towards
class Spam:
time_to_cook = Minutes(0)
but that could give the misleading impression that the value of time_to_cook
is actually used.
I'm also considering missing it out entirely, and mentioning it in the docstring instead.