Created
February 28, 2014 00:48
-
-
Save mtomwing/9262932 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import abc | |
class Plugin(object): | |
__metaclass__ = abc.ABCMeta | |
@abc.abstractmethod | |
def this_method_is_required(self, foo): | |
pass | |
class SpecificVideoPlugin(Plugin): | |
def this_method_is_required(self, foo): | |
return foo[::-1] | |
# Trying to instantiate the interface directly will result in an exception | |
plugin = Plugin() | |
# However instantiating the subclass will work because it overrode the abstract method | |
plugin = SpecificVideoPlugin() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment