[Edu-sig] Python Pedagogy
kirby.urner at gmail.com
Fri Jul 21 06:02:54 CEST 2006
Although we all agree to use 'self' as the "me object" proxy, it's not
a keyword, and we could use a different stand in, e.g.:
class Human (object):
def __init__(me, name):
me.name = name
return 'Hi, my name is %s' % me.name
>>> import subgenius
>>> aguy = Human('Bob')
'Hi, my name is Bob'
It occurs to me that I could test "me" in place of "self" as it's
shorter, and as it might encourage a first person identification which
I think needs to happen when tackling OO.
We explored earlier on this list the difference between CivBuilder 3rd
person games, like SimCity and Civilization IV (many others), and 1st
person shooters e.g. Quake and Doom.
Of course many games give both 1st and 3rd, though we should
distinguish between two kinds of 3rd: 3rd as in "I am that character
(avatar, action figure or whatever, as in 'Alice')" vs. "I have some
god's eye view" (incorporeal flyer, as in Google Earth and most of
those WarCrafty type games, also Sims).
Likewise, I think when coming to think formally in terms of objects
(vs. informally, which begins with the emergence of language), it
helps to personally project a "self" into various household objects,
Like in the movie 'Cars' we need to *become* a thing, then ask (in the
first person): what are my behaviors/methods, what are my
attributes/properties? It's a game of "who am I" (or "who I am") and
is already a natural feature of childhood play (fantasy self
I'm thinking the word 'self', at least in English, is too '3rd person'
in some ways, and looking down on a lot of objects, each with a
'self', you have only a god's eye view. However, the grammar around
'me' is different -- there's only one of them (one first person), and
therefore thinking "me" promotes a kind of first person instrospective
attitude. And we *want* that, as an option, when modeling in OO.
So I'd be accomplishing two things in this lesson (involving
temporarily substituting "me" for "self" in some class definitions):
(a) I'd be communicating the subtle teaching that 'self is not a
keyword in Python' and (b) helping with the subliminal process of
personally identifying with various objects, in order to become a
better object-oriented programmer.
At the end of the lesson, I'd reinforce the canonical accepted 'self'
(i.e. the god's eye view) as the proper one, but hopefully students
would have taken to heart the point of this lesson.
Note that I'm not proposing this as a "for kids only" type lesson plan
experience. I've been brainstorming a lot about what a Computer
Science for Liberal Arts Majors might look like (recent link below),
and this whole idea of "point of view" is already standard fare in
literature courses, as well as film theory. We can bridge to OO
through this "pronouns" discussion.
Note about 2nd person: many multi-player Internet games, plus
single-user games, do have a "we" concept, i.e. you're a part of a
team with a shared objective, up against other players, or up against
the computer, as the case may be.
Related topic: me.__dict__ is a good intro to the idea of a "personal
namespace" in addition to basic Python -- a helpful notion in
psychology and diplomacy, where world views may start far apart, but
grow closer through growing familiarity with the others' operations.
It's in the tradition of Leibniz to want to use some "machine
language" as a basis for diplomacy (American Transcendentalism has
echoes of that, e.g. in Fuller's 'cosmic computer' meme)).
Liberal Arts Compsci (except selling as Maths in this context):
More information about the Edu-sig