Skip to content

Instantly share code, notes, and snippets.

@hamiltont
Created August 13, 2014 16:30
Show Gist options
  • Save hamiltont/d55f21a4136e17290ace to your computer and use it in GitHub Desktop.
Save hamiltont/d55f21a4136e17290ace to your computer and use it in GitHub Desktop.
class attrExample(d:
def __getattr__(self, item):
"""
Returns the attr if it's part of attrExample, otherwise
return the attr from foo
"""
try:
return self.item
except KeyError:
return foo.item
@msmith-techempower
Copy link

class attrExample():

  def __getattr__(self, foo):
    """
    Returns the attr if it's part of attrExample, otherwise
    return the attr from foo
    """
    try:
      return self.item
    except KeyError:
      return foo.item

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment