Skip to content

Instantly share code, notes, and snippets.

@ianb
Created April 29, 2010 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianb/383855 to your computer and use it in GitHub Desktop.
Save ianb/383855 to your computer and use it in GitHub Desktop.
## Descriptors
## Anything with __get__ and __set__:
class classinstancemethod(object):
def __init__(self, func):
self.func = func
def __get__(self, obj, type=None):
def repl(*args, **kw):
return self.func(obj, type, *args, **kw)
return repl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment