Using __repr__ or __str__ for own printable class?

Mads Orbesen Troest mads at troest.NEVERMORE.dk
Tue Apr 15 13:09:08 EDT 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. :)

Regards,
/\/\\ads Orbesen Troest




More information about the Python-list mailing list