Skip to content

Instantly share code, notes, and snippets.

@appcoreopc
Created June 14, 2020 06:57
Show Gist options
  • Save appcoreopc/bfb6480fb5f3501932268e00314c3e1a to your computer and use it in GitHub Desktop.
Save appcoreopc/bfb6480fb5f3501932268e00314c3e1a to your computer and use it in GitHub Desktop.
def overrides(interface_class):
def overrider(method):
assert(method.__name__ in dir(interface_class))
return method
return overrider
class MySuperInterface(object):
def my_method(self):
print('hello world!')
class ConcreteImplementer(MySuperInterface):
@overrides(MySuperInterface)
def my_method(self):
print('hello kitty!')
x = ConcreteImplementer()
x.my_method()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment