
Oct. 21, 2011
2:45 p.m.
Hi everyone, I’ve sometimes wished that str(someclass) were the natural way to get a class name, for example when writing __repr__ methods. Guido expressed the same wish recently, so I’ve made a patch for Python 3.3. In the whole standard library, only one module (optparse) and three test files (which were parsing the output of str(someclass) or using doctests) had to be updated because of this change: http://bugs.python.org/issue13224 One can say that this change would break code and should thus be rejected; one could argue that the previous behavior of str(someclass) was undefined, or an implementation detail. What say you? Cheers