You are all correct. :-)

The way I think of it is that str() is used by print; repr() is used
by the interactive prompt. Clearly you want print 'abc' to print abc
without quotes; but in the interactive prompt you want different
output for the number 1 and the string '1', and that's what repr() is
for.

FWIW, for types that implement them the same, I'd like to see them
return something from which the type is obvious, i.e. repr()-like.
Just yesterday I helped someone debug an AttributeError where he was
convinced that an object was a string because its repr() looked like a
string; but it was a dbapi DateTime object (don't recall which
implementation).

--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to