Using __repr__ or __str__ for own printable class?

Mads Orbesen Troest mads at
Tue Apr 15 19:09:08 CEST 2003

On Tue, 15 Apr 2003 07:01:04 -0000, Donn Cave wrote:

Hi Donn, thanks for your feedback;

> I personally think the simplest and most useful way to look at it is
>   __str__: your object's data as a string
>   __repr__: your object as a string.

That's a good rule of thumb, I think; I will remember that. :)

/\/\\ads Orbesen Troest

More information about the Python-list mailing list