Learning OOP...

Alex Martelli aleaxit at yahoo.com
Mon Jun 11 15:59:01 EDT 2001

"Mats Wichmann" <xyzmats at laplaza.org> wrote in message
news:3b25059c.5089017 at news.laplaza.org...
> Whew, you sure get an education on this group.  Pope Sylvester?

Ooops, sorry for the too-tangential mention.  Gerbert of Aurillac,
945 (ca)-1003, made Pope Sylvester II in 999.  Besides a hectic
religious and political career, he wrote a treatise on the abacus
which was the standard for centuries, developed the principle
of constant-pressure acoustic organs, built the first clock using
a pendulum as the time-regulating device, and allegedly also
introduced Arabic numerals to the West (he surely did know them,
having studied in Arab Spain as a youth, but the "introduction"
is controversial indeed).  Among his many distinctions, he was
as close as it gets to a Ghibelline, almost-Protestant Pope (a
lot of what he wrote in favour of the power of Kings, Emperors,
local Churches, &c, and against Papal supremacy, he wrote of
course before he was Pope -- but he didn't reverse himself in
his 4 extremely-active years on Peter's Seat), close personal
friend of French and German kings -- the first French Pope --
and rumored by spoken tradition to be the real founder of the
Studium in Bologna (officially recognized only 100 years later,
which still suffices to make it oldest in the Western world:-).

Protestants and Gallicans resurrected his memory 500 years
later, shedding the centuries of legends about Gerbert as a
great Black Magician, and restoring his numerous-enough
claims to real, historical distinction.  Why people are so keen
to forget him, I don't know.  Perhaps we're all so totally
convinced of the year 1,000 as an age of ignorance and dark
superstition that we'd rather forget that the then-Pope was
a figure so contrary to this hard-to-dislodge misconception:-).

> >> "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.

Yes, and yes -- to be succint for once:-).  Inheriting in Java is a very
high commitment choice -- even more than in C++, since you only
get to choose ONE base class:-).

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

No blanks there, just an overly long sentence as is my wont; to
restate the essential part thereof, when you need the semantics
of Python's inheritance, it's absurd to rebuild them from pieces --
they're already there, just ready for reuse!

Those semantics, by the way, are ones of easy-as-pie mutual
calls (and to a lesser importance, data-access) between super
and sub-classes...


More information about the Python-list mailing list