Dumping an instance

Roy Smith roy at panix.com
Wed Mar 16 03:55:49 CET 2005


In article <mailman.472.1110941476.1799.python-list at python.org>,
 gf gf <unknownsoldier93 at yahoo.com> wrote:

> If I want to dump (for debugging) an instance and all
> of it's member attributes, what's the simplest way?
> 
> print myInstance
> 
> just gives a pointer to its location in memory

You need to write a str() method for the class.  Alternatively, take a look 
at the pprint module.



More information about the Python-list mailing list