Get all object attributes in Python?
Use the built-in function dir().
Use the built-in function dir().
kind_of? and is_a? are synonymous. instance_of? is different from the other two in that it only returns true if the object is an instance of that exact class, not a subclass. Example: “hello”.is_a? Object and “hello”.kind_of? Object return true because “hello” is a String and String is a subclass of Object. However “hello”.instance_of? Object returns … Read more
If you insist, here is some horrible inspect-based solution. I hope it will inspire you to reevaluate the problem you have and look for another approach.
You are really mixing together two different things. Use dir(), vars() or the inspect module to get what you are interested in (I use __builtins__ as an example; you can use any object instead). Print that dictionary however fancy you like: or Pretty printing is also available in the interactive debugger as a command: