[Edu-sig] Elementary School Instruction

Kirby Urner urnerk at qwest.net
Sat Jun 11 06:39:24 CEST 2005


> > So the idea that much younger kids are grasping syntax like
> > this:

> >   >>> thewords = {'noun1':'house', 'noun2':'mouse'}
> >   >>> print "In this %(noun1)s there lives a %(noun2)s." % thewords

> > makes me weep in frustration.
> 
> No, you shouldn't. You can't expect this from most children I know of.
> This requires a lot of abstract thinking, which is based on lots of
> experience and "having seen this again and again". What you and I can
> read in code is so different from a beginners view, we probably can't
> imagine it.
> 

This is why I think math class and programming should be more or less the
same subject and/or course of study in K-12.[1]  

Because in math we're already paying very close attention to nit picky
details of syntax.  cos(x) and cos(-x) mean different things.

I'd like to see worksheets where students take the role of the Python
interpreter and come back with the proper response to stuff like:

1.

 >>> a = 4 + 4
 >>> a
____

2.

 >>> a * 3

____

3.

 >>> a + a + a

____

And so on.  Scheme has books like this.  Cover one side with your hand and
reveal the answers as you go down the page, mentally answering.  Matthias
has a great book like that, from the early days of the project.

With Python, you need to get into the list pretty early.  That's a rich
syntax.

23.

 >>> thelist = ['carbon dioxide', 'mercury', 'iron sulfide', 'argon']
 >>> thelist.sort()
 >>> thelist

_______________

24.

 >>> thelist[2]

___________

And so on.  It's OK if the answers are easily available (like, check it on
your computer).  

The concept here is to develop expectations, so that you're not neutral
about what the computer comes back with.  You've developed some mental
reflexes of your own, and now anticipate what Python will do.  That's called
"knowing Python."


44. 

 >>> thenumbers = {'one':1, 'two':2, 'three':3}
 >>> print "Easy as %(one)s-%(two)s-%(three)s!"

_______________

45. 

 >>> thewords = {'noun1':'house', 'noun2':'mouse'}
 >>> print "The %(noun2)s is in the %(noun1)s."

_________________

I don't regard the syntax for interpolating dictionary values into a string
any more arcane or difficult than run-of-the-mill algebraic expressions.  I
agree that junior starts out staring blankly and meaningless strings.  But
if we're able to make headway in algebra, we should be able to make headway
in Python.  I suggest that learning them in tandem would actually make both
easier; each would leverage the other, so to speak.

Kirby

[1] http://mathforum.org/kb/message.jspa?messageID=3800953&tstart=0
(the mock battle I mention is something along the lines of OSCON versus the
NCTM -- science fiction, but still worth thinking about IMO).





More information about the Edu-sig mailing list