On 10/23/11 06:26, Steven D'Aprano wrote:
Antoine Pitrou wrote: [...]
It might be the integer 1 or the string "1". You need repr() to tell the difference.
Antoine, that's a cheap shot. The *very next paragraph* of my post which you replied to, and which you snipped out of your response, says:
I am aware that the string representation (using either __str__ or __repr__) of an object is not the definitive word in what the object really is. Using just print, one can't distinguish between a class and a string "<class '__main__.Spam'>", or for that matter between the string 2 and the int 2, and that arbitrary objects can return arbitrary strings. Nevertheless, I like the __str__ of classes, modules and functions just the way they are.
Can we please stop throwing up this red herring?
Well, if you stop throwing the red herring of "but you can't decide between strings and classes anymore".
By your own quote you're now down to "but I like it the way it is", which is fine as a -1 in the "voting", but please don't make it seem like you have subjective arguments.