If I do this:
def f(self): print self
class c1: pass
setattr(c1, 'm1', f)
Then f is automagically transmogrified into the appropriate sort of
method depending on how it is used:
c1.m1
unbound method c1.f
c1().m1
bound method c1.f of __main__.c1 instance at 0x51e738
c1().m1()
__main__.c1
Ron Garret [EMAIL PROTECTED] wrote:
I want to say:
trace(c1.m1)
and have c1.m1 be replaced with a wrapper that prints debugging info
before actually calling the old value of m1. The reason I want that
to be an instance of a callable class instead of a function is that I
need a place
Duncan Booth wrote:
Ron Garret [EMAIL PROTECTED] wrote:
I want to say:
trace(c1.m1)
and have c1.m1 be replaced with a wrapper that prints debugging info
before actually calling the old value of m1. The reason I want that
to be an instance of a callable class instead of a function
Ron Garret wrote:
The reason I want to do this is that I want to implement a trace
facility that traces only specific class methods. I want to say:
trace(c1.m1)
and have c1.m1 be replaced with a wrapper that prints debugging info
before actually calling the old value of m1. The reason
Ron Garret wrote:
The reason I want to do this is that I want to implement a trace
facility that traces only specific class methods. I want to say:
trace(c1.m1)
and have c1.m1 be replaced with a wrapper that prints debugging info
before actually calling the old value of m1. The reason
In article [EMAIL PROTECTED],
Kent Johnson [EMAIL PROTECTED] wrote:
Ron Garret wrote:
The reason I want to do this is that I want to implement a trace
facility that traces only specific class methods. I want to say:
trace(c1.m1)
and have c1.m1 be replaced with a wrapper that
In article [EMAIL PROTECTED],
Michele Simionato [EMAIL PROTECTED] wrote:
Duncan Booth wrote:
Ron Garret [EMAIL PROTECTED] wrote:
I want to say:
trace(c1.m1)
and have c1.m1 be replaced with a wrapper that prints debugging info
before actually calling the old value of m1.