What makes Python Python (was: OO in Python (was Re: Migrating to perl?))

Alex Martelli aleaxit at yahoo.com
Sat Jan 6 04:53:32 EST 2001


"Cameron Laird" <claird at starbase.neosoft.com> wrote in message
news:200101051648.KAA49133 at starbase.neosoft.com...
    [snip]
> Your particulars inspire me to a tangent:  what's makes
> Python's character?  One of the things I thing we should tell
> newcomers is that it's a superlatively "tolerant" language;
> even if you use only tiny pieces of Python, it can feel good.

I think the Python language is 'small' enough that one does
not really 'subset' it all that much in actual use -- big, rich
languages are the ones for which using a subset is most
common.  So, although what you say is true, I think that
maybe it places the emphasis a bit misleadingly.

> Contrast this with, say, Perl, where regular expression-think
> determines so much, or Java, which insists that a strong OO
> model be nearby.  Ask Python to be a procedural language for
> you, though, and it calmly acquiesces.

OK, Python, although being small and simple, is multiparadigm: in
this way, strange as it may seem, it resembles C++!  The latter,
after all, is the canonical example of a OO language which lets
you use it procedurally (and with other degrees of freedom yet,
such as with/without templates).  In fact, in C++, subsetting is
_frequent_ -- it's so big, most users get by on a fraction of it.

Perl is also typically subsetted (inevitably: if there are N ways to
do each task, most people will normally use just 1 or 2 of them),
although I think you're right that basically all actually-used subsets
of it have a regular-expression core.


> So:  how's Python special?  Well, I'll dismiss white space
> and much else as (mere, but also crucial) syntactic sugar.

OK.  Nice, but not the essence.

> Exceptions are important, and distinctive; moreover, they
> predicate multi-method style.

What multi-methods?  We don't have them (Dylan, e.g.,
does).  I may be misreading your meaning...?  Python
exceptions are nice, but the difference with (e.g.) C++'s
or Java's does not seem to be all that huge.

> Similar languages frolic
> pridefully with their overloading, but Python simply expects
> objects to sort out for themselves what to do with messages:
> lovely!  Metaprogramming is some of the best of Python ...
> There's also something (or a couple of things?) to say in
> this context about testing, but I don't yet know how to
> articulate it.

In all of this, the similarity with Smalltalk is strong.  Emphasis
on testing (XP _was_ born for Smalltalk), metaprogramming
possibilities, polymorphism via dynamic runtime dispatching
(objects responding to messages).


I'm afraid I haven't answered your question.  What I see is
a range of aspects, each pretty good, but, also, each rather
similar to corresponding areas of one or more other languages.
The really strange thing is, the various parts meld into a
whole that is greater than the sum of the parts!  If I
"designed" a language by cherry-picking thinks I liked from
others, the result would be sure to be an unholy mess.  Guido
somehow managed to get synergy and power instead!  I _think_
the emphasis on "utter simplicity (tempered by an ounce of
very solid Dutch common sense)" is the real secret in the mix;
perhaps, the emphasis on simplicity _in the implementation_
*helps*, by imposing nonobvious underlying constraints that
push in the right direction.  Just musing aloud...!


Alex






More information about the Python-list mailing list