[Python-ideas] Access to function objects

Nick Coghlan ncoghlan at gmail.com
Tue Aug 30 10:25:51 CEST 2011

On Tue, Aug 30, 2011 at 4:10 PM, Eric Snow <ericsnowcurrently at gmail.com> wrote:
> 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.

That's actually quite an interesting idea, although I'm wondering if
it could make some of our extant reference cycle issues associated
with stack traces even worse. The fact that the patch is so simple is
certainly rather appealing (although you have a few backwards
compatibility issues to address, as I noted in my review).

Also, I wouldn't be quite so quick to discard the function information
in the class evaluation case. While the function involved there is a
temporary one, it's still a real function.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list