On Jan 12, 8:56 pm, Aaron <[email protected]> wrote:
> Argh, the 'self' variable. It's been a while since I've used Python.

Heh. Explicit 'self' is one of those things, some people love, some
people hate. Myself, I like it. Whatever one's feelings about it
stylistically, it is darned useful to have around for those
exceptional moments when you want to explicitly pass some value in to
override the normal value of 'self':

e.g. instead of:

    myinstance.method(*args)

You could call:

    MyClass.method(othervalue, *args)

Then inside 'method', the value of self will be 'othervalue' instead
of 'myinstance'. This works regardless of whether othervalue is an
instance of MyClass or not. That's not something you could do if self
was implicit.

One of those dynamic things you should almost never do, but the odd
time you need to, it can really save your bacon.

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to