Created
June 27, 2013 15:43
-
-
Save haridsv/5877544 to your computer and use it in GitHub Desktop.
Static methods in Python are inherited. See: http://stackoverflow.com/questions/136097/what-is-the-difference-between-staticmethod-and-classmethod-in-python/136138?noredirect=1#comment2605431_136138
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
class B(object): | |
@staticmethod | |
def identify(): | |
return "B" | |
def iden(self): | |
return self.identify() | |
class D(B): | |
@staticmethod | |
def identify(): | |
return "D" | |
assert B().iden() == "B" | |
assert D().iden() == "D" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment