On Tue, 08 Nov 2011 15:17:14 +1100, Lie Ryan wrote:
> On 10/31/2011 11:01 PM, dhyams wrote:
>>
>> Thanks for all of the responses; everyone was exactly correct, and
>> obeying the binding rules for special methods did work in the example
>> above. Unfortunately, I only have read-only access to th
On 10/31/2011 11:01 PM, dhyams wrote:
Thanks for all of the responses; everyone was exactly correct, and
obeying the binding rules for special methods did work in the example
above. Unfortunately, I only have read-only access to the class
itself (it was a VTK class wrapped with SWIG), so I had
On Oct 31, 8:01 am, dhyams wrote:
> Thanks for all of the responses; everyone was exactly correct, and
> obeying the binding rules for special methods did work in the example
> above. Unfortunately, I only have read-only access to the class
> itself (it was a VTK class wrapped with SWIG), so I ha
Thanks for all of the responses; everyone was exactly correct, and
obeying the binding rules for special methods did work in the example
above. Unfortunately, I only have read-only access to the class
itself (it was a VTK class wrapped with SWIG), so I had to find
another way to accomplish what I
On 10/29/2011 05:20 AM, Ethan Furman wrote:
Python only looks up __xxx__ methods in new-style classes on the class
itself, not on the instances.
So this works:
8<
class Cow(object):
pass
def attrgetter(self, a):
print "CAUGHT: At
dhyams wrote:
Python 2.7.2
I'm having trouble in a situation where I need to mix-in the
functionality of __getattr__ after the object has already been
created. Here is a small sample script of the situation:
=snip
import types
class Cow(object):
pass
# this __getattr__ works
On Fri, Oct 28, 2011 at 1:34 PM, dhyams wrote:
> If I call __getattr__ directly, as in bessie.__getattr__('foo'), it
> works as it should obviously; so the method is bound and ready to be
> called. But Python does not seem to want to call __getattr__
> appropriately if I mix it in after the objec
Python 2.7.2
I'm having trouble in a situation where I need to mix-in the
functionality of __getattr__ after the object has already been
created. Here is a small sample script of the situation:
=snip
import types
class Cow(object):
pass
# this __getattr__ works as advertised.