Created
February 3, 2010 19:51
-
-
Save vlazzle/293947 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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