identity of the caller?

Bob Horvath bob at horvath.com
Thu Feb 24 08:38:13 EST 2000


Michael Hudson wrote:

> 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.

Well, somebody already emailed me how to do it.  I realize that it is
normally a bad idea.  And I am always open to better way of doing it.

>
>
> > 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...

I'm not sure I understand your suggestion.

> HTH, but I doubt it...
> Michael

I'm doubt it too. I suspect there is a more clever way to do it, just that
I am not clever enough to at the moment to think of it.




More information about the Python-list mailing list