Created
January 10, 2014 21:43
-
-
Save cjhanks/8363271 to your computer and use it in GitHub Desktop.
parent class
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
class Parent(object): | |
def method(self, *args, **kwargs): | |
raise NotImplementedError('NOT DONE') | |
@classmethod | |
def impl_method(Cls, data): | |
print(Cls, data) | |
class Child1(Parent): | |
def method(self, k): | |
return self.impl_method(k) | |
class Child2(Parent): | |
def method(self, k): | |
return self.impl_method(k) | |
c1 = Child1() | |
c2 = Child2() | |
c1.method(3) | |
c2.method(3) | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment