Closed
Description
If an object is deprecated in Python 3.12, to be removed in Python 3.14, should we decorate it like this? (1)
@deprecated("Will be removed in Python 3.14")
class Foo: ...
Like this? (2)
@deprecated("Deprecated in Python 3.12; will be removed in Python 3.14")
class Foo: ...
Or like this? (3)
if sys.version_info >= (3, 12):
@deprecated("Will be removed in Python 3.14")
class Foo: ...
else:
class Foo: ...
For somebody who uses Python 3.8, it might be surprising if a type checker started emitting warnings about an object being deprecated if the runtime only emits a DeprecationWarning
on Python 3.12+. For that user, Python 3.14 will be a long way away; they might not even be able to switch to the newer way of doing things yet (perhaps the "replacement idiom" only exists on Python 3.9+). For us in typeshed, however, (3) is obviously the most tedious option for us to maintain, as it will mean more branches.
Thoughts?