# Getting all objects from a class (except parent)
my_object = awspice.ec2
method_list = [ func[0] for func in inspect.getmembers(my_object, predicate=inspect.isroutine) if callable(getattr(my_object, func[0]))]
# Excluding private methods
methods = filter(lambda x: not x.startswith('_'), method_list)
for method in methods:
x = getattr(my_object, method)
print('Running method:',x.__name__)
x()
Last active
February 4, 2019 10:02
-
-
Save davidmoremad/3e825489d4a66ad670b42642f7d83394 to your computer and use it in GitHub Desktop.
Common snippets or tips for Python
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment