Python is remarkably liberal in its design, in that 'self' is not a keyword. You're free to use other names for this important place in memory.
Yet there's still self-imposed discipline (another way of saying 'self discipline'), such that we tend to all use 'self' anyway, by convention (but Python-the-interpreter doesn't complain if we don't -- not likely to change). However, as Python teachers have widely remarked, this concept of 'self' is not easily communicated at first, given the OO paradigm is itself still coming into focus for some students. In the class definition, the 'self' is really a 'place holder' (akin to zero) i.e. it doesn't do any work, but keeps a place open, like a driver's seat waiting for a driver. When an *object* of said class is created, the self becomes specified, as a kind of *anchor*. And plumbing the depths of 'self' is easy: all you need is __dict__ (i.e. a self is basically another namespace, a concept already familiar from earlier discussions). Python-by-comic-book (including on the net) is an emerging genre, influenced by Head First, Dive Into, and For Dummies series. I'm storyboarding for comics (could be TV shows) in which ' this ', ' me ' and ' ghost ' each get a crack at occupying the ' self ' position. Each of these English options has its own logic and connotations. I especially like ' ghost ' because of its ' ghost in the shell ' connotations (a link to manga, the genre we're in).[1] As Python goes towards Unicode, other "non-Romanji" substitutes for ' self ' may suggest themselves. However (back to self-discipline) I think it's wise to stick to the guidelines and go with non-idiosyncratic forms. David Goodger was good on this in his 'Idiomatic Python' at OSCON 2007 [2]: If your object is an iterable (i.e. has a "duck face" (which is like being a "duck type" but sounds more like "interface")) then address as such, as in in 'for myvar in self.__dict__', and not using has_key() or some such more specialcase form. In this same spirit (aha! another one), we just go with 'self' at the end of the day. Kirby [1] http://www.imdb.com/title/tt0113568/ http://www.imdb.com/title/tt0347246/ (theme song choral sequences some of my all time favorites) [2] http://oscon07.icalico.org/talk/view/271 Also mentioned in my blogs: http://controlroom.blogspot.com/2007/07/idiomatic-python.html _______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig