
On Sun, Aug 7, 2011 at 6:10 AM, Guido van Rossum <guido@python.org> wrote:
But rather than a prolonged discussion of the merits and use cases, I strongly recommend that somebody tries to come up with a working implementation and we'll strengthen the PEP from there.
-- --Guido van Rossum (python.org/~guido)
Here's a stab at a (relatively) simple approach to the function portion: http://bugs.python.org/issue12857 However, this does not expose __function__ in the locals. Instead it puts f_func in the frame object. Thus it provides the functionality, but doesn't invite abuse. And whether you like it or hate it, it's exactly what I've been looking for. -eric p.s. I tried doing it with a closure and, while it worked, I didn't like it. I will say that I came away with a _much_ better understanding of the CPython implementation (and gdb :). I feel much better about the f_func solution, particularly since we're really looking for the function associated with a frame. Trying to artificially force __function__ into the frame's locals just didn't feel right.