Skip to content

Instantly share code, notes, and snippets.

@konradhalas
Created July 22, 2013 19:44
Show Gist options
  • Save konradhalas/6056985 to your computer and use it in GitHub Desktop.
Save konradhalas/6056985 to your computer and use it in GitHub Desktop.
Simple solution how to extract function object from bound method.
def view_example(request):
print(request)
class ViewTestCase(object):
view_function = view_example
def __init__(self):
self.view = self.__class__.__dict__['view_function']
vtc = ViewTestCase()
vtc.view("it's alive!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment