May-21-2020, 04:43 PM
(This post was last modified: May-21-2020, 04:44 PM by deanhystad.)
Think about replacing get_descriptive_name with __str__. __str__ is what print uses when it converts things to strings for printing.
It is unusual to have a lot of print statements in a class. If someone wants to use your class they don't want to worry about stuff appearing in the console when their code calls update odometer.
If it is illegal to roll back the odometer you should either disallow or raise an exception. Users of your class will not appreciate the disallow and nag approach.
If a subclass doesn't do anything differently in a method it does not have to (should not) implement the method. This is even true for __init__. It is perfectly OK to declare a class that has no methods or no attributes. It is unusual, but some people feel a need to classify things that are essentially the same.
It is unusual to have a lot of print statements in a class. If someone wants to use your class they don't want to worry about stuff appearing in the console when their code calls update odometer.
If it is illegal to roll back the odometer you should either disallow or raise an exception. Users of your class will not appreciate the disallow and nag approach.
If a subclass doesn't do anything differently in a method it does not have to (should not) implement the method. This is even true for __init__. It is perfectly OK to declare a class that has no methods or no attributes. It is unusual, but some people feel a need to classify things that are essentially the same.