Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

John Posner jjposner at optimum.net
Sat Dec 19 14:33:59 EST 2009


On Fri, 18 Dec 2009 13:00:48 -0500, Alf P. Steinbach <alfps at start.no>  
wrote:

>
> Chapter 2 is about Basic Concepts (of programming). It's the usual:  
> variables, ...

1. Overall suggestion

You have a tendency to include non-pertinent asides [1]. But then,  
rambling a bit endows a manuscript with the author's distinctive voice.  
Fortunately, we live in a hypertext-enabled world, where you can have your  
cake and eat it, too. I suggest that you go over your manuscript with a  
ruthless eye, and turn your rambles into hypertext-accessible "sidebars".  
See how much you can reduce the length of Chapter 2, which current runs 98  
pages!

2. Comments on Section 2.6.7, "References & automatic garbage collection"

There's a spell-check evader on page 2:49: "trough" s.b. "through". And  
your spell-checker should have caught "adressable" on page 2:48.

I find your sequence-of-attribute-lookups approach to the topic of  
"variable assignment" interesting. The directed-graph illustration on page  
2:49 even hints at the fact that in the world of Python, names ("turtle",  
"forward", etc.) and objects (various kinds of yellow boxes) are very  
different things.

(I suggest getting rid of the callout "Very small fixed size variable".  
That way, only objects, not names, have the italicized callouts.)

But using the term "references" and the directed-graph metaphor has its  
drawbacks. Avoiding the term "reference" will make it easier to navigate  
the turbulent waters of call-by-reference vs. call-by-value vs.  
call-by-name. (You don't even stick a toe in those waters in Section  
2.7.5.) Combining memory addresses with the directed graph metaphor  
invites the reader to think at way too low a level, IMHO.

Another metaphor just occurred to me: a scavenger hunt. It even fits in  
with your potentially-infinite-attribute-access approach to the topic. A  
sequence of attribute accesses:

    turtle.forward.__doc__

... is like a sequence of scavenger-hunt instructions:

    1. Get your next clue at the big oak tree
    2. Get your next clue at the back door of the Valley Bank
    3. Get your next clue under Dad's Oldsmobile

It's clear that the scavenger hunt's clues (short characters strings --  
like Python names) are different from the physical objects that you access  
as the hunt progresses (tree, bank building, automobile -- like Python  
objects). I haven't lived with this metaphor long enough to form an  
opinion as to where it might reside on the brain-dead <---> brilliant  
scale.

As I've said in this forum (and the edu-sig forum) before, I think the  
best metaphor for understanding Python variable assignment is John Zelle's  
yellow-sticky-note metaphor. [2]

I hope these comments help.

-John

--------------
[1] Examples:

Section 2, page 2:1

     It's almost impossible, but, as Robert A. Heinlein remarked,
     "A Paradox May Be Paradoctored".

Section 2, page 2:3

     (I believe the original text comes from the "Jargon file")
      about how arbitrary, undesirable and downright dangerous DWIM
      guessing can be: ...

Section 2.5.1, page 2:14

     a natural extension is to make that into a square spiral with
     far more windings; I recall it as a common theme in 1970’s
     pop-art and it can be quite impressive!

Section 2.6.7, page 2:46

     (some flat-Earthers once thought that the flat Earth rested
      on four turtles, which in turn stood on four larger
      turtles, and so on all the way down)

[2] "Python Programming: An Introduction to Computer Science" by John  
Zelle (Franklin, Biddle & Associates, 2004) See Section 2.5.1, "Simple  
Assignment"



More information about the Python-list mailing list