Skip to content

Instantly share code, notes, and snippets.

@vlazzle
Created February 3, 2010 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vlazzle/293947 to your computer and use it in GitHub Desktop.
Save vlazzle/293947 to your computer and use it in GitHub Desktop.
# if there are any others who don't care much for try ... catch AttributeError
def hasmethods(obj, *meth_names):
return all(
hasattr(
# if it calls like a method it's a method
getattr(obj, m, None),
'__call__'
) for m in meth_names
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment