Created
April 24, 2012 08:11
-
-
Save sunng87/2477769 to your computer and use it in GitHub Desktop.
python method missing
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 Proxy(object): | |
def __init__(self, target): | |
self.target = target | |
def __getattr__(self, name): | |
print "calling: ", name | |
return (lambda *x: self._call(*x)) | |
def _call(self, *args): | |
print "with args: ", args | |
print "closure value:", self.target | |
p = Proxy("hello") | |
p.test("tomcat", 2, 4, True, []) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment