identity of the caller?

Michael Hudson mwh21 at cam.ac.uk
Thu Feb 24 07:59:18 EST 2000


Bob Horvath <bob at horvath.com> writes:

> Is there any way to find out the identity of who called you?  I am
> mainly thinking of method calls, but in general if there is a way
> for regular function calls, I would be interested in that too.

Well, you can (or at least I can).  I'm not going to tell you how
though, as it sounds a really bad idea for this problem.
 
> I suppose I should give some context.   We have a tool that draws
> message flow diagrams for communications systems.  These flows are
> similar to use case flows, or ITU Z.120 MSC charts if you know
> what those are.  The tools takes simple ascii text which has the
> sender, the receiver, and the message name, as in...
> 
> SENDER RECEIVER MessageName
> 
> We tend to have to enumerate a lot of these, and I had the thought
> that if I could prototype the functionality of the nodes, they
> could generate the text used to generate the drawings.
> 
> What I was thinking is that the receivers of the message would
> define methods that handle them.  To get the picture right,
> I would need to print out method name, the receiver, and who sent
> it.  It is the "who sent it" bit that I can't visualize a solution
> for.

What's preventing you making method calls like:

    def sendMessage(self,msg):
        self.listener.recvMessage(message=msg,sender=self)

? I guess I'm not understanding your problem...

HTH, but I doubt it...
Michael

-- 
very few people approach me in real life and insist on proving they are
drooling idiots.                         -- Erik Naggum, comp.lang.lisp



More information about the Python-list mailing list