Created
October 17, 2011 14:28
-
-
Save mhubig/1292712 to your computer and use it in GitHub Desktop.
No Getter & Setter ...
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 Background(object): | |
def __init__(self): | |
self.color = "black" | |
def handle(self, handler): | |
handle.do(self) | |
class Handler(object): | |
def do(self, object): | |
object.color = "red" |
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 Background(object): | |
def __init__(self): | |
self.color = "black" | |
class RedBackground(Background): | |
def __init__(self): | |
super(RedBackground).__init__() | |
self.color = "red" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Was ist besser?