Python's simplicity philosophy

Douglas Alan nessus at mit.edu
Wed Nov 12 13:19:15 EST 2003


"Andrew Dalke" <adalke at mindspring.com> writes:

> Douglas Alan:

>> Then you weren't taught Computer Science -- you were taught Fortran
>> programming.  Computer Science teaches general concepts, not specific
>> languages.

> I agree with Alex on this.  I got a BS in CS but didn't learn about
> lambda, reduce, map, and other aspects of functional programming
> until years later, and it still took some effort to understand it.
> (Granted, learning on my own at that point.)

> But I well knew what 'sum' did.

How's that?  I've never used a programming language that has sum() in
it.  (Or at least not that I was aware of.)  In fact, the *Python* I
use doesn't even have sum() in it!  I've used a number of languages
that have reduce().  If I didn't already know that it exists, I
wouldn't even think to look in the manual for a function that adds up
a sequence of numbers, since such a function is so uncommon and
special-purpose.

(Someone pointed out that different versions of Scheme vary on whether
they give you reduce.  In Scheme reduce would have fewer uses since
Scheme uses prefix notation, and operators like "+" can already take
any number of arguments (this is a definite advantage to prefix
notation).  Therefore, in Scheme, to add up all of the numbers in a
list, you can just use apply and '+', like so: "(apply + my-list)".)

> Was I not taught Computer Science?

I would say that if you didn't get introduced to at least the concept
of functional programming and a hint of how it works, then something
was seriously wrong with your CS education.

>> But if you end up going and removing elegant features understood by
>> anyone who has studied Computer Science because you think your
>> audience is too dumb to make a slight leap from the specific to the
>> general that can be explained on one simple sentence, then you are
>> making those trade-off decisions in the *utterly* wrong manner.
>> You should be assuming that your audience are the smart people that
>> they are, rather than the idiots you are assuming them to be.

> Your predicate (that it's understood by anyone who has studied
> CS) is false so your argument is moot.

It's irrelevant whether or not many people have received poor CS
educations -- there are many people who haven't.  These people should
be pleased to find reduce() in Python.  And the people who received
poor or no CS educations can learn reduce() in under a minute and
should be happy to have been introduced to a cool and useful concept!

|>oug




More information about the Python-list mailing list