
Oct. 22, 2011
9:27 p.m.
On 10/22/11 22:32, Guido van Rossum wrote:
Thinking of str(x) as an API to get a certain value would lead there, yes. But thinking of str(x) as what gets printed by print(x), formatted by "{}.format(x)", and "%s" % s, changes things. When I am printing an object and I have no idea what type it is, I'll use repr() or "%r"; but when I know I am printing, say, an exception, I think it would be very nice if print(x) would just print its name. Just like print(None) prints 'None', it would make all the sense in the world if print(ZeroDivisionError) printed 'ZeroDivisionError', and print(type(42)) printed 'int'.
+1. Georg