Possible Duplicate:
Is there a function in Python to print all the current properties and values of an object?
In interactive python sessions I make a lot of use of the dir
function, to get a sense of an object's structure. Unfortunately, dir
only shows the names of attributes, not their values, so it is nowhere near as informative as it could be. Furthermore, dir
's print out makes no attempt to format the output for ease of reading (IOW: dir
don't do no stinkin' pretty-print).
Where can I find an "off-the-shelf" data-inspection utility that is more informative, and better formatted,
dir
?
For example, a more useful alternative to dir
would print the values (suitably formatted, as needed) associated with each attribute, and would format this output for easy reading. For attributes whose values are callable, it would print their signatures and/or the first lines of their docstrings.
Thanks!