Skip to content

Instantly share code, notes, and snippets.

@richo
Created April 11, 2013 06:30
Show Gist options
  • Select an option

  • Save richo/5361188 to your computer and use it in GitHub Desktop.

Select an option

Save richo/5361188 to your computer and use it in GitHub Desktop.
class Foo(object):
def method(self, foo):
def _(n):
print repr(self)
print repr(n)
return _
foo = Foo()
foo.thing = foo.method("butts")
foo.thing("lols") # meth's definition has access to self via local scope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment