Python for non-programmers

Neel Krishnaswami neelk at brick.cswv.com
Mon Mar 6 19:01:38 EST 2000


Kragen Sitaker <kragen at dnaco.net> wrote:
> 
> The Scheme-as-CS-101 crowd seems to think that it's a good idea to
> put off the whole mutability thing until later --- just have names
> and values, and don't worry about mutation until later.

My own experience matches that -- when I was introduced to functions,
they were explained to me as basically substitutions. That is, if I
had

  (define (square x) (* x x))

then I could imagine the interpreter taking

  (square 4)

and rewriting it to

  (* 4 4)

This was a really vivid and effective metaphor, because a) it is just
like the functions we're taught about in high school algebra, and b)
is a simple enough evaluation mechanism that when deeply confused I
could write down what I thought my program should do at each step on a
sheet of paper and examine it for thinking errors. And when starting
programming, even a tiny 5 or 6 line program was enough to engender
deep confusion. 

I *hated* mutation, simply because I needed to start thinking about
the deeply bizarre (to the novice me) and extraneous notion of
"environments". I didn't see what they had to do with my program *at
all*, and as far I was concerned they were an ad-hoc invention created
to make me fail my problem sets.

I think it's possible for a total novice to handle a language with
either mutation (eg BASIC), or functions (eg Scheme), but not both at
once. That will confuse them unless they are sharper than I was when
starting out -- I honestly have no idea how people were able to learn
how to program with Pascal. ;)


Neel



More information about the Python-list mailing list