__str__ vs. __repr__
jeremy at cnri.reston.va.us
Tue Nov 9 20:45:35 CET 1999
>>>>> "TP" == Tim Peters <tim_one at email.msn.com> writes:
>> Tim's Rat class is a good example of how __repr__ should not be
>> implemented, because it exposes the internal representation of
>> the object, not the external value.
TP> Beg to differ: it's an excellent example of how __repr__ should
TP> be implemented.
It's no accident that the function is called __repr__. It's role is
to expose the representation.
More information about the Python-list