Teaching python (programming) to children

Tim Peters tim.one at home.com
Tue Nov 6 01:03:35 CET 2001


[Hung Jung Lu]
> I have my doubts about Python being the first programming language to
> teach. I see all too many newbies running into the problem of
> namespaces. How do you explain to them that "from xyz import *" is a
> bad thing, if they don't even understand what's going on behind the
> scene?

You don't teach them about "import *" at first.  Neither metaclasses, nor
that the result of adding two signed float zeroes can depend on the hardware
rounding mode in effect <wink>.

> Also, how in the world can beginners understand what a hash
> table mean?

There's a reason they're called "dictionaries" in Python instead of "hash
tables":  if a kid is old enough to look up a definition in a real-life
dictionary, they're old enough to understand the essential nature of a
Python dict.  The ABC language (Python's closest predecessor) was
specifically designed for first-time programmers, and testing with newbies
confirmed that dicts (one of only two builtin ABC container types) weren't
hard to master.  Goodness, just picture having to teach one of the
alternatives (I'm picturing teaching balanced AVL search trees <wink>).

> Are we going to tell them something like: "oh well, think of Python
> dictionary as a magic black box, you'll understand it later
> when you take a course in C/C++"?

Of course!  They don't need to study circuit design to add two integers
effectively either.  "An association" is an everyday concept, and how it's
implemented is irrelevant to correct use (BTW, and unlike Python, ABC did
use AVL trees under the covers -- but ABC dict *semantics* were much the
same as Python's).

even-a-"print"-statement-is-heavy-duty-stuff-if-look-deep-enough-ly
    y'rs  - tim





More information about the Python-list mailing list