[Edu-sig] Python for Philosophers

kirby urner kirby.urner at gmail.com
Fri Oct 30 17:16:32 CET 2009

I was thinking more about this Python for Philosophers thread and
decided to write some "pathological Python" to help make a point,
thought readers here might be interested...

Note in the short class definition below, that not only do I not use
the name 'self' (which is not a keyword) but I use alternative names
in each of the two special name methods, 'cogito' and 'me'

Whereas this isn't great style (and I emphasize this in my "Short
Talk") it does drive home the point that this first argument is
*positional* and has meaning only within that method's scope, so yeah,
fine to use any legal name and even to change what that name is from
one method to the next ("fine" in the sense of not upsetting the
interpreter -- other readers of your code may not appreciate your

For more context:  http://controlroom.blogspot.com/2009/10/short-talk.html

class Animal:
    A template for any Animal.  What's somewhat
    pathological is the handle to the self object
    is not consistently named between methods,
    only within methods -- more traditionally, we
    would use the word 'self' in place of both
    'cogito' and 'me'.
    species = 'unspecified' # set below

    def __init__(cogito):  # my birth event
        """aquires the species from the template itself
        Make it be special to me (one self per instance)
        cogito.species = Animal.species

    def __repr__(me):  # my representation
        return me.color + ' ' + \
               me.species + ' ( sex: ' + me.sex + ')'


More information about the Edu-sig mailing list