Python's simplicity philosophy

Patrick Maupin pmaupin at speakeasy.net
Wed Nov 12 21:26:37 EST 2003


Douglas Alan wrote:

> Describing reduce() in 10 seconds is utterly trivial to anyone with an
> IQ above 100, whether or not they have ever used sum()

Well, yeah, but they may not need or want to learn or remember it.
And then there are the corner cases, e.g. sum([]) vs.
reduce(operator.add,[]) (which throws an exception).

> If someone can't understand this quickly, then they shouldn't be
> programming!

Again, it's not "can't", it's whether they need to or not.

> I'm sorry, but you are incorrect.  When I took CS-101, we learned
> assembly language, then were assigned to write a text editor in
> assembly language, then we learned LISP and were assigned to write
> some programs in LISP, and then we learned C, and then we were
> assigned to implement LISP in C.
> 
> If you can write a !$#@!!%# LISP interpreter in C, you no doubt can
> figure out something as mind-achingly simple as reduce()!

Ahh, the lisp background.  I _knew_ that would come out sometime :)

Seriously, though, even in this scenario -- you don't really need
reduce() to create a LISP interpreter (as I'm sure you found
when you wrote one in C).


> > Ignorance is not stupidity.
> 
> Assuming that your audience cannot learn the simplest of concepts is
> assuming that they are stupid, not that they are ignorant.

As I and others have pointed out, it's not a matter of assuming they
can't learn, it's a matter of assuming they have better things to
do.  Many people can write all the useful programs they will ever
need without reduce, and sum() makes the percentage of Python
users who can do this even higher.  (Having said that, I never
personally argued that reduce() should be removed from the language,
but I do agree that it does not have to be part of "core" Python,
and could easily be relegated to a module.)

> 
> >> I sure hope that Python doesn't try to emulate C.  It's a terrible,
> >> horrible programming language that held back the world of software
> >> development by at least a decade.
>  
> > I used to hate C.  But then, when it borrowed enough good concepts
> > from Pascal and other languages, and the compilers got smart enough
> > to warn you (if you cared to see the warnings) about things like
> > "if (x = y)"  I stopped using Modula-2.  C held software back 10
> > years in the same manner as Microsoft did, e.g. by helping to
> > standardize things to where I can buy a $199 system from WalMart
> > which would cost over $20,000 if everybody kept writing code like
> > the pointy-headed ivory tower academics thought it ought to be written.
> 
> You score no points for C by saying that it is like Microsoft.  That's
> a strong damnation in my book.  And you really don't know how the
> world would have turned out if a different programming language had
> been adopted rather than C for all those years.  Perhaps computers
> would be more expensive today, perhaps not.  On the other hand, we
> might not have quite so many buffer overflow security exploits.
> Perhaps we'd have hardware support for realtime GC, which might be
> very nice.  On the other hand, perhaps people would have stuck with
> assembly language for developing OS's.  That wouldn't have been so
> pretty, but I'm not sure that that would have made computers more
> expensive.  Perhaps a variant of Pascal or PL/1 would have taken the
> niche that C obtained.  Either of those would have been better, though
> no great shakes either.

I agree that I cannot know how the world would have turned out
without C and Microsoft; but likewise, you cannot know for sure
that computer science would be ten years farther along by now :)

(And I personally feel my alternate universe is more realistic
than yours, but then everybody should feel that way about their
own private alternate universe.)

> >> The reason for Python's wide acceptance isn't because it is
> >> particularly well-designed compared to other programming languages

> >> that had similar goals of simplicity and minimality (it also isn't
> >> poorly designed compared to any of them -- it is on par with the
> >> better ones) -- the reason for its success is that it was in the right
> >> place at the right time, it had a lightweight implementation, was
> >> well-suited to scripting, and it came with batteries included.
>  
> > I'd vote this as the statement in this group most likely to start
> > a religious flamewar since the lisp threads died down.
> 
> The only way it could start a religious flamewar is if there are
> people who wish to present themselves as fanboys.  I have said nothing
> extreme -- just what is obvious: There are many nice computer
> programming languages -- Python is but one of them.  If someone
> wishes to disagree with this, then they would have to argue that there
> are no other nice programming languages.  Now that would be a flame!

Well, I guess I may have read more into your original statement
than you put there.  You wrote "similar goals of simplicity
and minimality", and to me, the language is pretty much a gestalt
whole, in the sense that when I read "similar goals" I was thinking
about all the features that, to me, make Python Python.  These goals
actually include the lightweight implementation, the portability,
the suitability to scripting, etc.  In one way or another, I feel
that these contribute to its simplicity and minimality, and on
rereading your words, I think you were probably mainly referring
to the syntax and semantics.  (Even there, however, as I think Alex
has pointed out, design decisions were made which might make the
semantics less than optimal, yet contribute heavily to the small
size and portability of the language.)

> I'm not sure what you are getting at.  There were many nice
> programming languages before Python, but not many of them, other than
> Perl, were portable and well-suited to scripting.

I was just challenging you to defend a position which it appears
in hindsight you didn't really take :)

> 
> > 3) Do you _really_ think that all the batteries were included when
> > Python first came out?
> 
> It certainly was not a particularly popular language until it came
> with pretty hefty batteries.  There are many other languages that
> would have been equally popular before Python started coming with
> batteries.

Here is one area where I think the genius of the design shows
through.  Even _before_ the batteries were included, in a crowded
field of other languages, Python was good enough to acquire enough
mindshare to start the snowball rolling, by attracting the kind of
people who can actually build batteries.

> > Do you even think that Python has more batteries _right_ _now_ than
> > Perl (via CPAN), or that some competing language couldn't or hasn't
> > already been designed which can coopt other languages' batteries?
> 
> Um, the last time I checked Perl was still a lot more popular than
> Python, so once again I'm not sure what you are getting at.  Regarding
> whether or not some future language might also come with batteries and
> therefore steal away Python's niche merely due to having more
> batteries: Anything is possible, but this will be an uphill battle for
> another language because once a language takes a niche, it is very
> difficult for the language to be displaced.  On the other hand, a new
> language can take over a sub-niche by providing more batteries in a
> particular area.  PHP would be an example of this.

We are in agreement that Perl has more batteries than Python,
and also more "marketshare."  To me, this is yet another testament
to Python's good design -- it is in fact currently on a marketshare
ramp, mostly because it attracts the kind of people who can do an
excellent job of writing the batteries.

> > I can accept the premise that, for Python to enjoy the acceptance it
> > does today, Guido had to be lucky in addition to being an excellent
> > language designer.  But if I were to accept the premise that
> > Python's popularity is due to sheer luck alone my only logical
> > course of action would to be to buy Guido a plane ticket to Vegas
> > and front him $10,000 worth of chips, because he has been extremely
> > lucky for many years now.
> 
> I never claimed *anything* like the assertion that Python's popularity
> is due to luck alone!

In the post I was responding to, you wrote "The reason for Python's wide
acceptance isn't because it is particularly well-designed compared to
other programming languages," and you also used the phrase "in the right
place at the right time."  To me, these statements taken together implied
that you thought the process leading to Python's ascending popularity was
mostly stochastic.

Your later posting (and a more careful reading of your original post) help
me to put your words in the proper context, and seem to indicate that our
opinions on the subject are not as divergent as I first thought they were.

Regards,
Pat




More information about the Python-list mailing list