Skip to content

Instantly share code, notes, and snippets.

@neotrinity
Created November 5, 2014 12:57
Show Gist options
  • Save neotrinity/9c7d7e9bffa898233723 to your computer and use it in GitHub Desktop.
Save neotrinity/9c7d7e9bffa898233723 to your computer and use it in GitHub Desktop.
getting my head around abc
import abc
class AbstractV(object):
__metaclass__ = abc.ABCMeta
def __init__(self, **kwargs):
for k, v in kwargs.iteritems():
setattr(self, k, v)
@abc.abstractmethod
def verify(self):
raise NotImplementedError("bbb")
class V(AbstractV):
def verify1(self):
print "verify"
#AbstractV.register(V)
print issubclass(V, AbstractV)
print isinstance(V(), AbstractV)
#v = V()
#v.verify()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment