[Python-ideas] Introspecting decorated functions? [was: Tweaking closures and lexical scoping to include the function being defined]

Nick Coghlan ncoghlan at gmail.com
Sun Oct 2 16:36:46 CEST 2011


On Sun, Oct 2, 2011 at 10:05 AM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> Should a bug be filed, or is this already part of your "improved
> introspection for closures" proposal?

There's a reason functools.wraps [1] exists (despite the way it works
being an egregious hack) :)

But that's also the reason I've been careful in my examples of
equivalent semantics to make sure the inner function name matches the
eventually bound name in the outer scope - without overwriting
metadata the way @wraps(f) does, duplicating information in the
original source code is the only other way to get informative
introspection results.

[1] http://docs.python.org/library/functools#functools.wraps

Cheers,
Nick.


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



More information about the Python-ideas mailing list