Learning OOP...

Mats Wichmann xyzmats at laplaza.org
Mon Jun 11 14:28:34 EDT 2001


On Mon, 11 Jun 2001 10:40:46 +0200, "Alex Martelli"


Whew, you sure get an education on this group.  Pope Sylvester?

Anyway, I'm anything but an OO theorist so a lot of the references in
this thread have been unfamiliar to me.


>> "Aggregate, not inherit".  Especially in python,

>Wrong, especially in Python.  When needed semantics are exactly
>those of Python's inheritance (which happens very often, because
>Python is very well designed), it is an absurd obfuscation
>exercise to rebuild the same mechanism, slowly and unreadably,
>on top of _other_ Python building-blocks, in the name of some
>abstract and inapplicable principle.

I've heard a number of folks claim that while inheritance is powerful,
it's often used where it need not to be, and that perhaps one should
think composition first. I tend to read that as particularly a problem
with compiled languages (I think Java, since that's the closest
comparison that I have any competency with), where you have to give
all the information to the compiler up front, and not so much with
Python where everything's dynamic.

Will you please fill in the blanks on your statement above, Alex?
"When the needed semantics are exactly those of Python's
inheritance"....  

Thanks,

Mats




More information about the Python-list mailing list