classification
Title: Create a @deprecated decorator (annotation)
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Leonardofreua, buhtz, eric.araujo
Priority: normal Keywords:

Created on 2021-07-21 19:07 by Leonardofreua, last changed 2021-08-18 08:42 by buhtz.

Messages (4)
msg397958 - (view) Author: Leonardo Freua (Leonardofreua) * Date: 2021-07-21 19:07
Would it be interesting to create a @deprecated decorator to avoid adding warnings.warn("deprecation message", DeprecationWarning, stacklevel=2) in methods body?

Using the decorator approach to indicate depreciation would make the methods cleaner (leaving only their responsibilities in the body) and would be easier to identify, as the cue would be close to the method signature and not mixed with the logic inside the body.

If everyone agrees, I could submit a PR (as a draft) for us to evaluate this functionality.
msg398385 - (view) Author: √Čric Araujo (eric.araujo) * (Python committer) Date: 2021-07-28 13:47
You should propose this on python-ideas!
msg398391 - (view) Author: Leonardo Freua (Leonardofreua) * Date: 2021-07-28 14:48
Ok thanks, I'll do it.
msg399824 - (view) Author: Christian Buhtz (buhtz) Date: 2021-08-18 08:42
This discussion on python-ideas
https://mail.python.org/archives/list/python-ideas@python.org/thread/62CTVNQ2GIS4B6WUBX23K4CCCK5MCGYL/
History
Date User Action Args
2021-08-18 08:42:47buhtzsetnosy: + buhtz
messages: + msg399824
2021-07-28 14:48:13Leonardofreuasetmessages: + msg398391
2021-07-28 13:47:09eric.araujosetnosy: + eric.araujo
messages: + msg398385
2021-07-21 19:07:38Leonardofreuacreate