Pro Python remarks to math ed folks (pointers)

Kirby Urner urner at alumni.princeton.edu
Mon Aug 23 16:16:26 EDT 1999


Some "Python as teaching language" emphasis in my recent
posts to elsewhere.  For those of you wanting to see how
I'm using Python with polyhedra, check out:

http://forum.swarthmore.edu/epigone/geometry-research/whelsendsnimp
http://www.deja.com/getdoc.xp?AN=516251867&fmt=text

My basic approach is to hit two key topics in tandem in
K-12:  computer programming and polyhedral geometry:  by
making polyhedra my paradigm objects (in the OOP sense,
but also in a literal easy-to-understand sense).

I'll add here (given this ng is for Python speakers) how 
happy I am with operator overloading, which I haven't 
had before, given my own path through the languages has
so far mostly skirted C/C++.

With a polyhedron object in P (say an icosahedron), Q=P*3 
is another polyhedron (same shape), but 3x larger, and 
the equally simple expression R=Q+v creates polyhedron R 
translated through space by vector v.  Short, sweet, to
the point.

The fact that a class is built around built-in __dict__ 
made it easy to go forward with concepts I'd already used
in the Java version of this exercise.  I have points A-Z 
as a set of reference points for anchoring a smallish set 
of polyhedra.  

In Java, I added lookup strings 'A'-'Z' with their associated 
vectors to a Hashtable.  In Python, a dictionary is even 
easier to use (same idea as Hashtable of course), and, even 
better, such a dictionary is already part of any class.  
Just define A=Vector(xyz=(1,0,0)) and you've got your 
{'A':Object} linkup for free!  Way cool.

Kirby
Curriculum writer
Oregon Curriculum Network
Cc: Synergetics-L at telelists.com

PS:  I've posted to this newsgroup once before so far:
http://www.deja.com/getdoc.xp?AN=490567169&fmt=text






More information about the Python-list mailing list