[issue868845] Need unit tests for <...> reprs

Éric Araujo report at bugs.python.org
Tue Oct 18 18:40:40 CEST 2011


Éric Araujo <merwok at netwok.org> added the comment:

> I sometimes wish that the str() of a class would return the class name
> rather than its repr(); that way "print(str)" would print "str"
> instead of <class 'str'>.  (Use case: printing an exception and its
> message: I wish I could print("%s: %s" % (err.__class__, err)) instead
> of having to use err.__class__.__name__.)
Me too.  I have a small metaclass to do that :)  Given your tentative support, I’ll open a feature request for 3.3.

> One could even claim that the repr() of a class could be the same
I think of repr first as “string form for debugging”, so I like the angle brackets.

----------
stage: test needed -> committed/rejected

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue868845>
_______________________________________


More information about the Python-bugs-list mailing list