Python's simplicity philosophy

Andrew Dalke adalke at
Wed Nov 12 21:19:45 CET 2003

> > But I well knew what 'sum' did.

Douglas Alan
> How's that?  I've never used a programming language that has sum() in
> it.

1) From Microsoft Multiplan (a pre-Excel spreadsheet).  That
  was one of its functions, which I used to help my Mom manage
  her cheese co-op accounts in ... 1985?

2) I wrote such a routine many times for my own projects
By 1987 I was using a BASIC version (QuickBasic) which
had functions and using Pascal.  But I don't recall in either of
those languages ever passing functions into an object until I
started using non-trivial C a couple of years later.  (Probably
for a numerical analysis class.)

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

Uncommon?  Here's two pre-CS 101 assignments that use
exactly that idea:
  - make a computerized grade book (A=4.0, B=3.0, etc.) which
      can give the grade point average
  - make a program to compute the current balance of a bank
      account given the initial amount and

That's not to say that the BASIC I used at that time had support
for functions.  It's only to say that the functionALITY is common
and more easily understood than reduce.

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

It may be.  That was my third-place major, which I did mostly
for fun.  I focused more on my math and physics degrees, so might
have skipped a few things I would have learned had I been more
rigorous in my studies.

It may also be that my department focused on other things.  Eg,
we had a very solid "foundations of computer science" course
compared to some CS departments, and we learned some fuzzy
logic and expert systems because those were a focus of the

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

Actually, your claim is 'anyone can be explained reduce() in 10 seconds' ;)

I tell you this. Your estimate is completely off-base.  Reduce is
more difficult to understand than sum.  It requires knowing that
functions can be passed around.  That is non-trivial to most,
based on my experience in explaining it to other people (which
for the most part have been computational physicists, chemists,
and biologists).

It may be different with the people you hang around -- your
email address says '' which is one of the *few* places
in the world which teach Scheme as the intro language for
undergrads, so you already have a strong sampling bias.

(I acknowledge my own sampling bias from observing people
in computational sciences.  I hazard to guess that I know more
of those people than you do people who have studied
computer science.)

                    dalke at

More information about the Python-list mailing list