Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lrudecorator overwrites wrapped function's __name__ and __doc__ (doesn't use functools.wraps) #10

Closed
cabiad opened this issue Mar 13, 2015 · 0 comments

Comments

@cabiad
Copy link

cabiad commented Mar 13, 2015

See https://docs.python.org/2/library/functools.html#functools.wraps for details.

The following ipython session demonstrates the issue:

In [8]: def s_plain(y):
   ...:     "square a number"
   ...:     return y * y
   ...: 

In [9]: s_plain.__doc__
Out[9]: 'square a number'

In [10]: s_plain.__name__
Out[10]: 's_plain'

In [11]: @lrudecorator(100)
def s(x):
    "square a number"
    return x * x
   ....: 

In [12]: s.__doc__

In [13]: s.__name__
Out[13]: 'wrapped'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant