Skip to content

Instantly share code, notes, and snippets.

@Frost
Created June 26, 2012 13:54
Show Gist options
  • Select an option

  • Save Frost/2995906 to your computer and use it in GitHub Desktop.

Select an option

Save Frost/2995906 to your computer and use it in GitHub Desktop.
method_missing in python
class MethodMissing(object):
def method_missing(self, attr, *args, **kwargs):
"""Stub: override this function"""
raise AttributeError("Missing method %s called." % attr)
def __getattr__(self, attr):
def callable(*args, **kwargs):
return self.method_missing(attr, *args, **kwargs)
return callable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment