[Tutor] Who called me?
project5 at redrival.net
Tue Nov 8 20:57:34 CET 2005
Bill Campbell wrote:
> Is there a way in python for a method to determine its parent?
> In particular, I'm working with SimpleXMLRPCServer, and would
> like to be able to find the client_address in the routine that
> has been dispatched. I know that client_address is an attribute
> of the handler class instance, but don't know how to get to that.
I'm not sure what you mean by its parent (also never worked with
SimpleXMLRPCServer). Something like this?
>>> class A(object):
>>> class B(object):
>>> def func(self):
... print self.__class__
>>> A.f = func
>>> B.f = func
>>> a, b = A(), B()
>>> a.f(), b.f()
Mail address in header catches spam. Real contact info:
''.join([''.join(s) for s in zip(
"poet at aao.l pmfe!Pes ontuei ulcpss edtels,s hr' one oC.",
"rjc5wndon.Sa-re laed o s npbi ot.Ira h it oteesn edt C")])
More information about the Tutor