[Python-ideas] Access to function objects

Ben Finney ben+python at benfinney.id.au
Tue Aug 9 02:09:23 CEST 2011

Guido van Rossum <guido at python.org> writes:

> To me it just means that __func__ will remain esoteric, which is just
> fine with me. I wouldn't be surprised if there were use cases where it
> was *desirable* to have a way (from the inside) to access the
> undecorated function (somewhat similar to the thing with modules
> below).

Perhaps I misunderstand the functionality, but:

The ability to access the undecorated function would be of great help in
our Django-based project. Django is very decorator-happy, and we are
trying to introspect code and, given a particular URL, determine the
innermost function (more precisely, what location in our code) that
actually handles that URL.

Is that a use-case of interest?

 \        “Always code as if the guy who ends up maintaining your code |
  `\     will be a violent psychopath who knows where you live.” —John |
_o__)                                                         F. Woods |
Ben Finney

More information about the Python-ideas mailing list