Skip to main content


Hey, #python devs. I want to be able to enforce that methods overriding existing methods raise an error if they don't have an @override decorator. Likewise, if they have that decorator and don't override a method, it should also throw an exception.

Didn't see anything which does this, so I threw this together. https://gist.github.com/Ovid/1a1d7869b29816cc4c82d00ad42aa2fc

Am I missing something obvious?

in reply to Curtis "Ovid" Poe (he/him)

https://pypi.org/project/overrides/ not only provides `@override` for earlier Pythons, it also allow the parent/base class to enforce overrides, which is really the way to go as opposed to having all the derived classes enforce it individually.
in reply to Mohammad Sajid Anwar

@manwar Yeah, decorators mixed with magic methods really give you a lot of flexibility in altering the language to suit your needs!