Raymond Hettinger wrote: > So, it would be nice if there were some support for carrying forward the > argspec to inform help(), calltips(), and inspect(). What were you thinking of? I could imagine a predefined class, such as class copyfuncattrs: def __init__(self, f): self.f = f def __call__(self, func): res = self.f(func) res.__name__ = func.__name__ res.__doc__ = func.__doc__ res.__dict__.update(func.__dict__) return res This could be used to define a decorator @copyfuncattrs def trace(f): def do_trace(*args): print "invoking", f.__name__, args return f(*args) return do_trace which in turn could be used to decorate a function @trace def hello(): "Print a nice greeting" print "Hello, world" which in turn could be called and inspected hello() print hello.__doc__ Then, the question is where copyfuncattrs should live, and I would object that to be yet another builtin. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4