Vikram wrote:
__repr__ should return something that when eval'ed yields an identical
object (if possible).
That's strictly possible in so few cases that it's not
really a very helpful guideline, in my opinion.
I find the following view more helpful:
* str() is for producing the normal output of a program,
to be seen by the user.
* repr() is for debugging output, and should indicate
reasonably unambiguously the *type* of the object.
When debugging, it's often at least as important to
know what type of object you have as what value it
has.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list