Python Forum
not finding the resone for the error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
not finding the resone for the error
#4
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.
Reply


Messages In This Thread
not finding the resone for the error - by yukhei - May-21-2020, 02:32 PM
RE: not finding the resone for the error - by Yoriz - May-21-2020, 03:30 PM
RE: not finding the resone for the error - by deanhystad - May-21-2020, 04:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  not finding the resone for the error yukhei 3 2,464 May-22-2020, 03:39 PM
Last Post: deanhystad
  not find the resone it not prints yukhei 3 2,599 May-22-2020, 03:36 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020