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

Cameron Laird claird at starbase.neosoft.com
Fri Jan 5 11:48:02 EST 2001


In article <934noe02o73 at news2.newsguy.com>,
Alex Martelli <aleaxit at yahoo.com> wrote:
>"Cameron Laird" <claird at starbase.neosoft.com> wrote in message
>news:3284C8A2D218D5A4.904FDBE7634A2E21.13E03F073E968847 at lp.airnews.net...
>    [snip]
>> Does *Object-Oriented Software Construction*
>> not make your "cut-off", Alex?
>
>It's a really good book.  It also leans heavily on strong
>assumptions on the object-model: compile-time static typing,
>multiple-inheritance, classes, no multimethods (dispatching
>only on the one object that 'receives the message'), etc.
>
>Some of the assumptions fit in well with Python (mi, classes,
>no multimethods), others go very much against its grain (no
>compile-time static typing).
>
>
>> Hmm; perhaps your examples answer my question.
>> I'll counter, though, that even single-inheri-
>> ted Python is quite a wonderful thing.
>
>If one subscribes to this view, then maybe Liu's "Smalltalk,
>Objects, and Design" may be suitable -- it was several years
>ago that I read it, and my memory of it is not very sharp,
>but, as I recall, it _was_ a really good book (some Smalltalk
>orientation, of course; but if one can take deep differences
>such as single vs multiple inheritance in stride, then a few
>syntax-sugar issues &c might not matter all that much).
>
>Instance data in Smalltalk are never visible outside the
>object instance, so the OO style you'll learn from this is
>going to be somewhat heavy with accessor/mutator methods.
>But I guess that's all right, as long as one keeps it in
>mind that this approach may not be optimal in Python.
>
>
>Alex
>
>
>

You deliver valuable content so charmingly I feel privileged
simply to copy everything once more without elision.

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

So:  how's Python special?  Well, I'll dismiss white space
and much else as (mere, but also crucial) syntactic sugar.  
Exceptions are important, and distinctive; moreover, they
predicate multi-method style.  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.

Also:  Python generally makes the One Right Coding clear, is
nicely portable and agnostic, and has the "advisory" thing
(it's easier to write safely, but you can introspect yourself
into danger if you choose) going at several levels.
-- 

Cameron Laird <claird at NeoSoft.com>
Business:  http://www.Phaseit.net
Personal:  http://starbase.neosoft.com/~claird/home.html



More information about the Python-list mailing list