Jeroen Demeyer wrote:
I have seen multiple discussions where somebody wants to deprecate a useless function but somebody else complains that we cannot do that because the function in question cannot be removed (because of backwards compatibility). See https://bugs.python.org/issue29548... for an example. We currently have a deprecation policy saying that functions deprecated in version N cannot be removed before version N+2.
Do we have that officially written down anywhere? The closest I know is https://www.python.org/dev/peps/pep-0387/ but that PEP is still a draft. And for me the "official" policy is if you deprecate in N you can remove in N+1, not N+2. (But all of this is a bit wonky with Python 2.7 still being alive and not being able to remove anything from the stdlib unless it's severely broken until 2.7 hits EOL).
That's a reasonable policy but some deprecation purists insist that it MUST (instead of MAY) be removed in version N+2. Following this reasoning, we cannot deprecate something that we cannot remove. Personally, I think that this reasoning is flawed: even if we cannot remove a function, we can still deprecate it. That way, we send a message that the function shouldn't be used anymore. And it makes it easier to remove it in the (far) future: if the function was deprecated for a while, we have a valid reason to remove it. The longer it was deprecated, the less likely it is to be still used, which makes it easier to remove eventually. So I suggest to embrace such long-term deprecations, where we deprecate something without planning in advance when it will be removed. This is actually how most other open source projects that I know handle deprecations. I'd like to know the opinion of the Python core devs here.
I prefer removal for ease of maintenance (people always want to update code even if it's deprecated), and to help make sure people who don't read the docs but discover something via the REPL or something and don't run with warnings on do not accidentally come to rely on something that's deprecated.