Python for non-programmers
sholden at bellatlantic.net
Thu Mar 2 20:13:20 CET 2000
Dennis Lee Bieber wrote:
> [Alexander Williams discussed teaching programming]
> And, naturally, Python then goes and turns around one of the
> main concepts of the old Intro classes... That variable names map to
> fixed addresses...
> A = B + 3
> Intro=> find the box at address B, copy the contents into a
> register/accumulator, add 3 to it, then find the box at address A and
> replace the contents with the stuff in the register.
> Python=>find the box with the "B" post-it note stuck to the front,
> create a copy of the contents in some empty box, add three to the
> contents of the (formerly) empty box, create a post-it note with "A" on
> it, and stick the post-it note to the box
... and this is without having to further explain that some boxes can
have several (hundred ...) post-it (tm) notes stuck on them, and that
when you remove the last post-it you can use the box for something
Dealing with Icon, Python and similar languages it's a lot easier to
teach to non-programmers by having the variables be fixed boxes which
contain pointers to "values" which live "out there" (you don't want
to start explaining heaps, stack frames, etc).
An assignment is then just an optional creation of a new value (if
it has an expression on the RHS) followed by an overwriting of the
variable's contents with a pointer to the new value.
More information about the Python-list