[Python-ideas] Standard way to get caller name and easy call stack access

Sven Marnach sven at marnach.net
Thu Mar 22 13:55:55 CET 2012


Nick Coghlan schrieb am Do, 22. Mär 2012, um 18:01:31 +1000:
> Once again, you're painting with a broad sweeping brush "ah, it's
> horrible, it's too hard to do anything worthwhile" (despite the
> obvious contradiction that many projects already implement such things
> quite effectively) instead of suggesting *small*, *incremental*
> changes that might actually improve the status quo.

To be fair, Anatoly *did* suggest an incremental change -- adding the
function caller_name().  And I think this raises a good point: It is
outright impossible now to access the qualified name of a calling
function.  Adding an 'co_qualname' attribute to code objects would
facilitate this.

Another point Anatoly raised is that the mere function names mentioned
in tracebacks often are less useful than fully qualified names.  So
how about including the qualified names in the traceback?

Cheers,
    Sven



More information about the Python-ideas mailing list