subclassing versus object redefinition

  • Thread starter wheres pythonmonks
  • Start date
W

wheres pythonmonks

Hi!

I have a class (supposed to be an abstract base class):
In python (as opposed to static languages like C++) I don't seed to
subclass the base class, but instead I can simply override the
behavior of stub methods and values.
Is there a preference between between subclassing (C++ approach) and
overriding methods/data in an instance? From a design perspective?
I think I prefer the override/redefine approach because it result in a
thinner class hierarchy.

It seems like inheriting an ABC is needed only when I must share
instances (between multiple parts of the code, or if the subclass is
instantiated in different places...)

Thoughts?

W
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top