Yeah, I like that idea. It would be great if this could support more than just stdlib. Here's a recent request to provide this for other libraries.
I presume that a decorator would work best here, since it's typically functions and classes that we want to deprecate (as opposed to variables, type aliases, or attributes). Perhaps the decorator could accept a bool value to accommodate static expressions involving the python version.
from typing import deprecated # Unconditionally deprecated @deprecated def foo1(): ... # Conditionally deprecated based on target Python version @deprecated(sys.version_info >= (3, 9)) def foo2(): ...
Does it make sense for this decorator to come from the typing module, or is there another module that's more appropriate?
What runtime effect (if any) would this decorator have on a function or a class?