Teaching python (programming) to children

Steve Holden sholden at holdenweb.com
Mon Nov 5 20:32:00 CET 2001

"Hung Jung Lu" <hungjunglu at yahoo.com> wrote ...
> Nomad <nomad***@***freemail.absa.co.za> wrote in >...
> > IMHO, python would be one of (if not _the_) best language to teach
> > beginning programming - not just children, but as you mention, there
> > is the difficulty with the "englishness" of the language (or almost
> > any other programming language).
> 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. You simplify, so they initially don't even realise it's possible.
If they don't know they can do something, beginners aren't as likely to get
into trouble by abusing the feature.

>           Also, how in the world can beginners understand what a hash
> table mean? 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++"?
You appear to be making the mistake of assuming that the beginner *must*
understand the implementation of an object to be able to use it. If this
were the case we would never learn to drive a car, or to speak natural
languages. A good teacher manages to select useful, and usable, simplifying
assumptions which the beginner can comprehend in terms of their present
understanding. A magic black box isn't a bad way to understand
dictionaries - certainly it's easier for the beginner than looking into hash
functions, buckets, collision chains, and all the other mess that (may) live
under there, and would simply server to confuse.

> Python seems very friendly, at first sight. But unless you really
> understand the dictionary and namespace (and name binding) mechanisms
> behind it, you'll run into surprises in no time. And at that moment,
> there is simply no way that it could be explained in easy terms to
> beginners, when they don't understand things like pointers,
> references, memory stack and heap, hash tables.
Certainly the beginner should be taught to expect the unexpected, since it
should not be hidden from them that their understanding is simplified. When
their mental model ceases to fit the language they are probably ready to
have it expanded. But if I accepted your argument, that would logically
imply that a begineer would have to understand RISC/CISC instruction sets
and the von Neumann model before they could write a program in BASIC.

> I do believe Python should be part of a programmer's school
> curriculum, but I really doubt it can be a good first language to
> learn, unless some technicality questions are addressed properly.
This is where we differ. I would ignore the difficult bits until they
insistently present themselves to the beginner. "Why doesn't it work like
you taught me" is a great question for a beginner, and until it is asked the
taught level of understanding is adequate.

> Or is there a good way of teaching to make it less traumatic for
> beginners to grasp the concepts of dictionary, name spaces, assignment
> by reference? It is just really really annoying that every single
> newbie has to be explained on these issues, and many of them end up
> without understanding it. I can't imagine teachers having a good time
> at these issues. I mean, it's OK to make students understand these
> Python issues, but the time required is not negligible, and the
> knowledge gained is limited in scope: these peculiarities are very
> Python specific. And it's doubly frustrating when after spending all
> the time, the students end up without understanding it. What can you
> do? It's not the fault of the average students or the average
> teachers, when the language itself has a non-trivial component that's
> hard to explain/understand.
Here I believe your focus on what a "newbie" is has changed, to include
programmers arriving at Python via some other language. A programmer who is
familiar with C, or C++, or any other single language, will bring a whole
set of assumptions with them -- and they do, repeatedly, try to transfer
their existing knopwledge to the new language. One who has programmed in
several languages will ask more sensible questions, but they will still need
to know Python specifics. THey will simply have a larger base of referent
concepts to call upon for explanation and enlightenment.

I therefore believe that "Python for C Programmers" would, and should, be a
very different class from "Python for Beginners": the former would have to
focus on differences between the two langugae environments, while the latter
could use many simplifying analogies without ever having to discuss exactly
how lists, tuples, dictionaries and classes are structured and implemented.


More information about the Python-list mailing list