A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-September/048610.html below:

[Python-Dev] decorator support

[Python-Dev] decorator support [Python-Dev] decorator supportRaymond Hettinger raymond.hettinger at verizon.net
Sun Sep 5 07:07:35 CEST 2004
In my experiments with decorators, it is common to wrap the original
function with a new function.

After creating the new function, there are efforts to make it look like
the old:

  newf.__doc__  = oldf.__doc__        # copy the docstring
  newf.__dict__.update(oldf.__dict__) # copy attributes
  newf.__name__ = oldf.__name__       # keep the name (new in Py2.4)

All is well and good except the argspec.  Running help() on the new
function gives:

     funcname(*args, **kwds)
        The original docstring

Running help() on the original function gives:

     funcname(arg1, arg2)
        The original docstring

So, it would be nice if there were some support for carrying forward the
argspec to inform help(), calltips(), and inspect().

FWIW, I do know that with sufficient gyrations a decorator could do this
on its own, but it is way too difficult for general use.



Raymond

More information about the Python-Dev mailing list

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