Message145839
| Author |
eric.araujo |
| Recipients |
belopolsky, eric.araujo, georg.brandl, gvanrossum, ncoghlan, petri.lehtinen, terry.reedy |
| Date |
2011年10月18日.16:40:39 |
| SpamBayes Score |
0.00039415897 |
| Marked as misclassified |
No |
| Message-id |
<1318956040.48.0.616870464826.issue868845@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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. |
|