briancurtin / deprecation

A library to handle automated deprecations
Apache License 2.0
88 stars 31 forks source link

Allow decorating without argument list #38

Open ErikBjare opened 6 years ago

ErikBjare commented 6 years ago

Minor usability issue, should be easy to fix.

Tried using it today and got a weird error.

Traceback (most recent call last):
  ...
  File "/home/.../lib/python3.7/site-packages/deprecation.py", line 232, in _function_wrapper
    function.__doc__ = "".join(string_list)
AttributeError: 'list' object attribute '__doc__' is read-only

This was easily resolved by changing the decorating line from @deprecated to @deprecated(), but expected behavior for most decorators (ime) is to behave identically if arguments were given or not.

If you're fine with this @briancurtin I'll make a PR.

briancurtin commented 6 years ago

As long as it doesn't complicate the implementation, if you can make that work I'd be fine with it. I don't suspect that using this with no arguments is a very common case, as the specific versions are necessary for the test failure behavior, and those plus the description are needed for anything useful to come out of the documentation changes.