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

Sven Marnach sven at marnach.net
Wed Mar 28 13:06:34 CEST 2012

Eric Snow schrieb am Tue, 27. Mar 2012, um 19:24:37 -0600:
> The same questions stand for adding a co_func (for the function whose
> definition resulted in the code object) [2].  I'd rather have a
> co_func than a co_qualname.  Then you can do
> code.co_func.__qualname__.

How is this supposed to work?  The code object is created at
compilation time, while the function object is only created when the
function definition is executed.  For functions nested inside another
function, a new function object is created everytime the outer
function runs, reusing the same code object that was created at
compilation time.


More information about the Python-ideas mailing list