Eric Snow <ericsnowcurren...@gmail.com> added the comment:

My response to a similar query:

What it enables is the ability to introspect the *actual* function object 
belonging to the currently executing code, whether in the same execution frame 
or in a later one on the stack.  We don't have that now.  The best we can do is 
guess, and I'm trying to refuse the temptation by building in an alternative 
that doesn't get in the way (and doesn't provide an attractive nuisance).

My motivation for this patch was to be able to find out, in one of my 
functions, what function called it and to interact with that function object.  
The name or file represented in the code object on the stack didn't cut it; and 
decorators and function factories make the whole thing a mess.  Guido sounded 
rather positive to the idea, which is why I pursued it.  From Guido's post to 
which I linked in the issue[1]:

   > For me the use case involves determining what function called my
   > function.  Currently you can tell in which execution frame a function
   > was called, and thereby which code object, but reliably matching that
   > to a function is not so simple.  I recognize that my case is likely
   > not a general one.

   But it is a nice one. It solves some issues that pdb currently solves
   by just using a file/line reference.

Not that it necessarily matters, but I could dig up the bit of code that 
motivated the whole thing.  I recall it was something related to writing an 
enum library (a la flufl.enum).  Anyway, I'd love to see this move forward.


[1] http://mail.python.org/pipermail/python-ideas/2011-August/011062.html

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12857>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to