Message145839
> 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. |
|
Date |
User |
Action |
Args |
2011-10-18 16:40:40 | eric.araujo | set | recipients:
+ eric.araujo, gvanrossum, georg.brandl, terry.reedy, ncoghlan, belopolsky, petri.lehtinen |
2011-10-18 16:40:40 | eric.araujo | set | messageid: <1318956040.48.0.616870464826.issue868845@psf.upfronthosting.co.za> |
2011-10-18 16:40:39 | eric.araujo | link | issue868845 messages |
2011-10-18 16:40:39 | eric.araujo | create | |
|