zeekay / decorum

Python decorator helper library.
MIT License
14 stars 2 forks source link

assigned=None preserves name and doc of decorator #19

Closed benoitbryon closed 9 years ago

benoitbryon commented 9 years ago

Given the following decorator "identity":

>>> import decorum

>>> @decorum.decorator
... class identity(object):
...     """Noop decorator: does nothing!"""

And the following decorated function "my_function":

>>> @identity(assigned=None)
... def my_function():
...     """My function's docstring."""

At the moment, README tells decorator's name and doc are empty...

>>> my_function.__name__ is None
True
>>> my_function.__doc__ is None
True

What about changing this behaviour to keep original name and documentation of decorator?

>>> my_function.__name__
identity
>>> my_function.__doc__
Noop decorator: does nothing!
zeekay commented 9 years ago

Yeah, that would be expected behavior I think.