Open bertsky opened 3 months ago
To elaborate: the use-case is quite simple: I have a library with an abstract method, which gets deprecated at some point. Inheriting code (not under my control) should see the deprecation warning when their implemented method gets called.
As a workaround, of course I can place the following in the superclass' constructor:
class Parent:
def __init__(self, ...)
...
setattr(self, 'fun', deprecated(reason='try not to laugh')(getattr(self, 'fun')))
But of course it would be much nicer if deprecated
would offer something along those lines itself.
This is a feature request (I think): I would like
deprecated
to be able to yield warnings on a method call, even when overriding the implementation in a subclass. In particular, I would like to be able to deprecate abstract methods.Expected Behavior
Running…
…I would like to see…
Actual Behavior
However, since the method is overriden, I can see no warning:
Environment