Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
class Thing(object):
def __init__(self):
self.__missing_method_name = None # Hack!
def __getattribute__(self, name):
return object.__getattribute__(self, name)
def __getattr__(self, name):
self.__missing_method_name = name # Could also be a property
return getattr(self, '__methodmissing__')
def __methodmissing__(self, *args, **kwargs):
print "Missing method %s called (args = %s) and (kwargs = %s)" % (self.__missing_method_name, str(args), str(kwargs))
t = Thing()
t.badness(123, 'an arg', blah="another argument here", zesty="woot")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment