[Tutor] Calling method in parent class

Alan Gauld alan.gauld at btinternet.com
Tue May 12 18:52:52 CEST 2009

"Jeremiah Dodds" <jeremiah.dodds at gmail.com> wrote

> Ahh, I stand corrected. Perhaps because the shop I work in is primarily
> python, and because we strongly favor composition over inheritance, I 
> never
> see (python) classes being used this way.

Composition over inheritance has now become so overused it
is losing one of the biggest adbvantages of OOP. That concept
was introduced because in the early days of OOP adoption
(early 90s) people were grossly abusing inheritance to reduce
coding but then causing horrible problems with maintenance
and reuse.

But inheritance is still the best mechanism when the "is-a"
relationship test is valid. Widgets in a GUI heirarchy are good
examples, as are bank acounts, data streams, etc

> Most of the time, when I see inheritance used in python, it's pretty much
> just classes being used as containers for common functionality.

Sadly thats often the case but its not really OO programming, its
just programming with objects! The hysteria over abuse of inheritance
has kind of thrown the baby out with the bathwater IMHO!

Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list