[Tutor] Getting caller name without the help of "sys._getframe(1).f_code.co_name" ?

patrice laporte zepangolin at gmail.com
Mon Feb 15 14:27:22 CET 2010

2010/2/15 Dave Angel <davea at ieee.org>

> This makes lots of sense.  If the message doesn't make sense to the user,
> there's no point.  But why then is your thread titled "Getting caller name"
> ?  Why does the user care about the caller (function) name?  When you
> started the thread, it seemed clear that your user was a programmer,
> presumably who was adding code to your system and who wanted to see context
> error messages in coding terms.
> If you have a duality of users, consider using a "DEBUG" variable, that
> changes the amount of detail you display upon an error.
> DaveA
No, it's not, I don't have duality at all... As I said in a previous answer,
when I started the thread, I was looking for a way not to use sys._getframe.
And I have now both the answer and an explanation.

But someone asked me "why do you want to do this ? explain it to us." And I
started to explain, and the thread then moved to new horizon, driffting to
other consideration : the user.

To answer you, the user I think about is the one who use the application,
not the programmer. But yes, the user who need to know the "caller name" is
the programmer, and that programmer must think himself as the other user,
the first one. This is just my point of view : never forget the final user.

So, maybe we can close that thread now ?  But any new question/answer is


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100215/d83ed81c/attachment.htm>

More information about the Tutor mailing list