[New-bugs-announce] [issue44701] Create a @deprecated decorator (annotation)

Leonardo Freua report at bugs.python.org
Wed Jul 21 15:07:38 EDT 2021


New submission from Leonardo Freua <leonardo.batista.freua at gmail.com>:

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.

----------
components: Library (Lib)
messages: 397958
nosy: Leonardofreua
priority: normal
severity: normal
status: open
title: Create a @deprecated decorator (annotation)
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44701>
_______________________________________


More information about the New-bugs-announce mailing list