>
> On Thu, Jan 13, 2011 at 4:34 AM, Jonathan Hartley <[email protected]>wrote:

> 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.
>

I think my eyes are bleeding. My opinion is that this should be relagated to
that (long) list of Python tricks which should never, ever be spotted in
production code.

Still, I guess when deadlines are looming and you plan to refactor later :)

*sorry, gmail's reply button is now trigger-able by keyboard mis-press.

-- 
Tristam MacDonald
http://swiftcoder.wordpress.com/

-- 
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