<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Python Ideas,<div class=""><br class=""></div><div class="">While working on some object-oriented projects in Java, I noticed that Python does not have an <b class="">@override</b> decorator for methods that are derived from a parent class but overridden for the unique purposes of a base class. With the creation of the <b class="">@abstractmethod</b> decorator, the override decorator could follow in clearly distinguishing the logic and design between parent/base classes.</div><div class=""><br class=""></div><div class="">Why I would think an override decorator might be useful:</div><div class=""><ol class="MailOutline"><li class="">For other people reading the code, it would be great to distinguish between methods that are unique to a class and methods that are inherited from a parent class. Not all methods inherited might be overridden, so keeping track of which inherited methods are overridden and which are not would be nice.</li><li class="">With the advent of static typing from mypy:</li><ol class=""><li class="">Having the decorator could corroborate the fact that the given method overrides the parent method correctly (correct name + parameter list).</li><li class="">When the parent class changes, such as the name or parameter list of an abstract method, the children classes should be updated as well. mypy could easily target the methods that need to be altered with the correct method signature.</li><li class="">If you don’t have an override decorator and overrode a parent method, then there could be some error complaining about this. This would be extremely useful to prevent accidental errors.</li></ol></ol><div class=""><br class=""></div></div><div class="">There is some interest for this as expressed on Stack Overflow (<a href="http://stackoverflow.com/questions/1167617/in-python-how-do-i-indicate-im-overriding-a-method" class="">http://stackoverflow.com/questions/1167617/in-python-how-do-i-indicate-im-overriding-a-method</a>) and some people have also made packages for this, but having it in the standard distribution would be nice. Thoughts?</div><div class=""><br class=""></div><div class="">Sincerely,</div><div class="">Shrey Desai</div><div class=""><a href="https://github.com/shreydesai" class="">https://github.com/shreydesai</a></div></body></html>