Why this doesn't work?

mk mrkafk at gmail.com
Fri Feb 19 15:45:12 CET 2010

John Posner wrote:
>> a
>> False
>> I expected to see 'nostatget' output: nostat.__get__ = nostatget
>> obviously failed to replace this function's __get__ method.
> I don't quite understand the above sentence, so I'm assuming that you 
> wanted the final "is" test to be "True" instead of "False".

No. I should have described my goal in plain English in first place.

I wanted to replace nostat function's __get__ descriptor with a function 
that would allow me to peek inside it (i.e. into __get__ descriptor 
arguments) and that would then call original nostat.__get__.

So no, I expected it to be false, that is, I expected to replace 
original descriptor with a "custom" descriptor. I just wondered why this 
custom "nostatget" descriptor didn't get called even though the new 
nostat.__get__ didn't seem to be its old self (so quite likely it was 
the new, nostatget, descriptor).

But Bruno pointed out that I need instancemethod for that, not plain 


More information about the Python-list mailing list