Created
April 18, 2012 05:46
-
-
Save willrjmarshall/2411343 to your computer and use it in GitHub Desktop.
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
# this is really verbose ##################################################################### | |
class ConfigureMyApp(object): | |
def init(self): | |
Looper(height = get_height(), width = get_width()) | |
class Looper: | |
def init(self, height = None, width = None): | |
self.set_height(height) | |
self.set_width(width) | |
def set_height(self, height): | |
# Do something clever with subclasses here | |
# This is much better ##################################################################### | |
class ConfigureMyApp(object): | |
def init(self): | |
self.looper = Looper() | |
self.looper.configure |l| | |
l.set_height(get_height) | |
l.set_width(get_width) | |
class Looper(object): | |
def configure(self, a_function): | |
a_function(self) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment