'How to query if function is deprecated

I have some functions like

@deprecated(reason="foo is deprecated")
def foo():
    pass

def bar():
    pass

if use_cpp_library:
    foo = get_cpp_lib_implementation(foo)
    bar = get_cpp_lib_implementation(bar)

The problem I have is that this foo "forgets" the @deprecrated decorator here when being replaced by a C++ binding. Can it (decorators) be programmatically queried for existence? And if yes, then query the reason?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source