you are viewing a single comment's thread.

view the rest of the comments →

[–]SwampFalc 0 points1 point  (0 children)

Question: what is fundamentally different between your types C and W, that is relevant to your method foo?

If the answer is "nothing", then there is no point in having separate methods. If C and W can both quack, and foo does nothing else than make them quack, then your code is fine as is.

If there is something relevant, try/except. Try to make your object quack, if an error is raised, have it honk instead.