Can print() be reloaded for a user defined class?

Mark Tolonen metolone+gmane at gmail.com
Sun Sep 20 02:30:40 EDT 2009


"r" <rt8396 at gmail.com> wrote in message 
news:c87c1742-e185-4377-a3ae-b32b912bcb5d at 33g2000vbe.googlegroups.com...
> On Sep 19, 9:53 pm, Peng Yu <pengyu... at gmail.com> wrote:
(snip)
> > I want to understand the exact meaning of the last line ('__repr__ =
> > __str__'). Would you please point me to the section of the python
> > manual that describes such usage.
>
> simple i assined any call to __repr__ to the __str__ methods.

Just define __repr__.  str() uses __repr__ if __str__ isn't defined.

-Mark





More information about the Python-list mailing list