Skip to content

Instantly share code, notes, and snippets.

@bil-bas
Last active December 16, 2015 19:49
Show Gist options
  • Save bil-bas/5487740 to your computer and use it in GitHub Desktop.
Save bil-bas/5487740 to your computer and use it in GitHub Desktop.
def __getattr__(self, name):
# _children is a list of strings referring to properties in the wrapper object.
for child in self._children:
child = getattr(self, child)
if hasattr(child, name):
return getattr(child, name)
return AttributeError("No attribute '%s' in any children of %s" % (name, self))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment