Created
November 5, 2014 12:57
-
-
Save neotrinity/9c7d7e9bffa898233723 to your computer and use it in GitHub Desktop.
getting my head around abc
This file contains 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 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