Skip to content

Instantly share code, notes, and snippets.

@ivangonekrazy
Created April 3, 2012 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivangonekrazy/2295325 to your computer and use it in GitHub Desktop.
Save ivangonekrazy/2295325 to your computer and use it in GitHub Desktop.
<method> ALL THE <type>!!!!!
from inspect import ismethoddescriptor, getmembers
def all_the_methods(_type):
"""
example usage:
all_the_methods(str)
sample elided output:
capitalize() ALL THE <type 'str'>!!!!
center() ALL THE <type 'str'>!!!!
count() ALL THE <type 'str'>!!!!
isalnum() ALL THE <type 'str'>!!!!
"""
for m in [n for n,o in getmembers(_type)
if ismethoddescriptor(o) and not n.startswith('_')]:
print "%s() ALL THE %s!!!!" % (m, _type)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment