Teaching python (programming) to children

Andrew Dalke dalke at dalkescientific.com
Tue Nov 13 13:43:13 EST 2001


Me:
>> When I started programming I didn't know how the hardware worked.
>> Nearly 20 years later, I still don't know.

David Andreas Alderud:
>when I was teaching the 4:th graders they constantly asked me on
>how computers worked, so I showed the everything from the ALU of
>the CPU up to operatingsystem interrupts

I don't think I ever asked those sorts of questions.  I was more
interested in getting computers to do math (gcd, lcm, primes,
unbounded ints, graphs, morphing, rotation matricies, physics
simulations).

Hmmm, and you also said (picking nits :)
> my view is that the students should teach them selves,

So your students weren't teaching themselves about hardware?

>I imagine it's hard to go from Python to any other language because it's
>easy to become lazy, even I've become lazy.

The word 'lazy' has negative connotations in America's traditional
Puritan outlook, although the Perl community spins it as a positive
characterisitic for programmers.

Since I don't know what you mean, I'm not able to comment further.

>> I still use dictionaries, heavily.  For commentary, see
>>
>> http://aspn.activestate.com/ASPN/Mail/Message/python-Tutor/538598
>
>Ordinary hashtables are bad in worst case, i.e. no better than simple
lists,

Oh, I understand.  I've just never had it hit me in reality.
Did you read the URL?  Tim says, amoung other things:
] ABC ran very slowly, mostly because the overhead of balanced tree
] operations swamps all other considerations until the trees grow
] quite large.

I've never hit the worst case in Python's dictionaries.  I've also
never seen a post in c.l.py where someone has hit a real life case
of getting the worst case.  (I do recall some theoretical ways to
hit it.)

>I normally design datastructures for a specific problem, though in all
>fairness I once used Python to implement a DMBS when I first learned
Python.

I normally design data structures to be easy to understand, and
only if there are problems do I switch to something more precisely
designed.  Because of Python's genericity, it's nearly always done
with a trivial change to use the new constructor.


>> Eg, I
>> recall wondering why I couldn't stick things into an array at position
>> arr(1.2) -- why was that the same as arr(1)?
>
>That's why BNF is so nice :)

Pardon?  BNF is Backus-Naur Form, right?  How does that help?

  expression ::= variable '(' number ')'
  variable ::= re(r"[_a-zA-Z]+")
  number ::= re(r"[0-9]+(\.[0-9]*)?")

There's nothing in there about implicit conversion of the numeric
value to integer when doing arr(1.2).


>> Ada, as I recall, doesn't have that flexibility.  So I figure it
>> would have been that much harder for me to figure things out.
>
>True, but there are nice packages for Ada which solve this with OO.

Which makes it still harder for a beginning, self-taught programmer.


>The Python tutorial is nice, but I don't think it's fair to compare them as
>they are intended for different audiences.

Are you talking about the tutorial vs. the primer Ada book I have
(in which case both are aimed at people like me)?  Or about the
two langauges?

What do you see as their audiences?  Eg, I see very little overlap
between the audience I work with (research scientists who need a tool
for exploring their research problem) and Ada's solution domain.

>> I would have needed a better editor than
>> Python's current text version.  BASIC with line numbers
>> makes it possible to edit a single line of code.
>
>I believe Python is a better choice than BASIC, though VB and BB are pretty
>good for being BASIC.

Not my point, which is that Python's text version (non-IDE) is worse for
developing code than BASIC's text version.  If I make a mistake in
Python when entering a function then I need to retype (or up-arrow
using readline) a lot.  In BASIC I could just edit the line number.
And BASIC offered auto line numbering, which means original entry
was effectively the same as Python's.

>> Not sure about the current IDEs either.  I heard one talk where
>> the presenter chose Tcl (withone of the object extensions) over
>> Python because it was easier for her coworkers to change a single
>> method interactively, rather than having to reload the whole
>> module, with all the trickiness that entails.
>
>There is no absolute truth about what language to choose; I'd pick Ada, you
>pick BASIC, and someone else would pick Logo.

Technically, I *picked* BASIC because that was all that came with
personal computers in the early 80s.  I would pick Python now, but only
with an IDE, and I would be concerned because with modules it's hard
to tell if you've properly reloaded them after edits.  (That issue
comes up pretty regularly in c.l.py.)

> The important thing is to get the student to code, without ever writing
> code it doesn't matter what language one uses.

Oh, I agree.  But didn't Dijkstra argue that students shouldn't be
taught to program until graduate school?  'Course, he's also the
one who said

"Object-oriented programming is an exceptionally bad idea which
 could only have originated in California."

"It is practically imposible to teach good programming to students
that have had a prior exposure to BASIC: as potential programmers
they are mentally mutilated beyond hope of regeneration."

so what does he know?

(BTW, these quotes brought to you by the letters 'P' and 'V' ;)

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list