Skip to content

Instantly share code, notes, and snippets.

@sunng87
Created April 24, 2012 08:11
Show Gist options
  • Save sunng87/2477769 to your computer and use it in GitHub Desktop.
Save sunng87/2477769 to your computer and use it in GitHub Desktop.
python method missing
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