Using __repr__ or __str__ for own printable class?

Steven Taschuk staschuk at
Tue Apr 29 18:22:20 CEST 2003

Quoth Steve Holden:
> "Steven Taschuk" <staschuk at> wrote in message
> news:mailman.1051490038.11587.python-list at
> Finally, the murk lifts and a dim light becomes perceptible. "str() is what
> the users will recognize. repr() is what the programmers will thank you
> for."

For repr, I'm happy with that statement.

But for str: Donn Cave pointed out rfc822.Message.__str__ (which
returns the complete headers) a while back; I feel that's a good
__str__, yet is not necessarily interesting or useful to a user
of, say, a mail client written in Python.  Indeed, it is primarily
useful programmatically, at the recipient's mail client.

> > *chuckle*  True.  (Not that I'm in any special position vis a vis
> > changing the documentation.  Quite the contrary.)
> Everybody is in the *same* position where changing the documentation is
> concerned: [...]

Yes.  Therefore nobody has a special position in this respect, and
in particular, I do not.  QED!

Steven Taschuk                                     staschuk at
Receive them ignorant; dispatch them confused.  (Weschler's Teaching Motto)

More information about the Python-list mailing list