What is the Python equivalent of Ruby's "inspect"?
Question: I just want to quickly see the properties and values of an object in Python,
how do I do that in the terminal on a mac (very basic stuff, never used
python)?

Specifically, I want to see what `message.attachments` are in [this Google App
Engine MailHandler example](http://pastie.org/680280) (images, videos, docs,
etc.).


Answer: If you want to dump the entire object, you can use the
[`pprint`](http://docs.python.org/library/pprint.html) module to get a pretty-
printed version of it.

    
    
    from pprint import pprint
    
    pprint(my_object)
    
    # If there are many levels of recursion, and you don't want to see them all
    # you can use the depth parameter to limit how many levels it goes down
    pprint(my_object, depth=2)
    

Edit: I may have misread what you meant by 'object' - if you're wanting to
look at class instances, as opposed to basic data structures like dicts, you
may want to look at the
[`inspect`](http://docs.python.org/library/inspect.html) module instead.

