Date: Thurs, 27 Apr 2007
    From: "Kirby Urner" <kirby.urner@gmail.com>
Subject: Recap of Python Python for Wanderers

I used this module for my first official
'Python for Wanderers' class @ Linus Pauling House
on Hawthorne.

Although Allen wasn't able to make the Tuesday night
generic talk, which was a sort of front loading
recruiting session, designed as a standalone but
also to build interest in this class, he had no
trouble getting up to speed (that's Allen Taylor
the 'SQL for Dummies' author, plus father to the
Taylor Twins, movie makers par excellance.  Link:

Other than the source code below, which takes the
source code from last week's wanderers.py and
develops the concept of inheritance, we didn't do
a lot with source code.  Instead, I covered the
following points (plus showed 'Warriors of the Net'):

* just as antiquities specialists get kudos and
fun lifestyles for knowing such dead languages as
Sumerian, we're still going to need new talent to
focus on old languages that aren't changing any
more, yet still have operational responsibilities,
e.g. M or MUMPS used by the VA, or ADA by the DoD.
Python helps recruit new talent to the world of
computer languages, but as a front end to a vast
and growing tool box of same, not as some be all
end all panacea.

* Python as a part of a Southern African curriculum
sequence, wherein we start with a Logo-inspired avatar
control experience (perhaps Logo itself) with the
youngest, move to a more immersive Squeak-like
environment (or Squeak itself initially), winding up
in Python for the final pre-college segment, wherein
we use this language to formalize some of the algebra
and geometry currently taught with almost no technology
in the classroom except calculators.  Cryptography
provides a lot of grist for the mill here, with
students reaching an understanding of RSA (a public
key algorithm) by the end of our sequence.

* My attempts to prototype elements of the above in
a more local context, in particular via Saturday
Academy and HPD (Hillsboro Police Department).
HPD's George Heuston recruited me 'n Jerritt Collord
to deliver 'Adventures in Open Source' to teenagers
at West Precinct in 2005.  I discuss this experiment
at somewhat more length in a Quicktime movie made
@ London Knowledge Lab during the Kusasa Summit in
London the following year (2006).  Link:

* The history of computer science in thumbnail,
starting with Rear Admiral Grace Hopper rescuing
us from too much tedium via her notion of the
compiler, which helped make Ada Byron's dreams
come true.  The Wild 'spaghetti code' West era
followed (that's really how assembler code needs
to be, but FORTRAN coded the same way is a bad
habit), until Edsger Dijkstra's religious revolution
and Structured Programming, followed in turn by a
divergence into several paradigms, a main one being
the Object Oriented and the Design Patterns it
supports (LISP and Scheme go another direction with
Functional Programming, APL and J in yet another
with Array Based Programming).

* Although we're still talking "warm fuzzy" animal
kingdom stuff below, if you just change Mammal to
Vector (or Quaternion), you're suddenly in a position
to use a sophisticated OO language to define 'math
objects', with mathematics itself an 'extensible
type system' (define your types using already-
existing types).  This is how many students outside
the USA are already learning mathematical thinking.
So maybe we'll make more headway in PDX with this
curriculum?  The local knowledge based economy (KBE)
would be well-served by such a trend, I confidantly
predict.  My current Pythonic Math course for
Saturday Academy @ PSU, for middle and high schoolers,
is another opportunity to prototype curriculum segments.

* The best way to teach Python is to focus on OO
concepts right out of the box.  Don't make newcomers
to programming slog through a lot of pre-OO style
thinking, which is where too many CS profs remain
stuck to this day, trying to make Python a crutch
for their lame/obsolete pedagogies.  The code below
represents me walking my talk in this regard, getting
into classes and subclasses as a part of our very
first meeting.

class Mammal:
    My funky Mammal class, based on a refactoring of
    last time's

    def __init__(self, name):
        """... a mammal is born..."""
        self.name = name
        self.stomach = []

    def eat(self, food):

    def poop(self):
        return self.stomach.pop(0) # FIFO

    def __repr__(self):
        return "I'm a mammal named " + self.name

class Dog (Mammal):
    My funky dog class
    def sound(self, n):
        print "Bark! " * n

    def __repr__(self):
        return "I'm a dog named " + self.name
    def __add__(self, other):
        return Dog(self.name + "-" + other.name)

class Monkey (Mammal) :
    My funky monkey class
    def sound(self, n):
        print "Hoot! " * n

    def __repr__(self):
        return "I'm a monkey named " + self.name

    def __add__(self, other):
        return Monkey(self.name + "-" + other.name)
so then you would go like:
>>> from wanderers_class0 import Monkey, Dog
>>> some_wanderer = Dog('Sarah Angel')
>>> some_other_wanderer = Monkey('Mono by Miguel') 
>>> some_other_wanderer.eat(some_wanderer)
>>> some_other_wanderer.stomach
[I'm a dog named Sarah Angel]
# code highlighted using py2html.py version 0.8