This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ramchandra Apte
Recipients Ramchandra Apte, loewis, orsenthil, roger.serwy, terry.reedy
Date 2012-06-08.13:40:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1339162827.17.0.719830127875.issue13532@psf.upfronthosting.co.za>
In-reply-to
Content
@Roger Serwy
>> Does anyone know a good way to make the exception render as: "must be str, not int" instead of "must be str, not <class 'int'>" ?
Use s.__name__ rather than type(s) for the type name
e.g.
-raise TypeError('must be str, not %s' % type(s))
+raise TypeError('must be str, not %s' % s.__name__)
History
Date User Action Args
2012-06-08 13:40:27Ramchandra Aptesetrecipients: + Ramchandra Apte, loewis, terry.reedy, orsenthil, roger.serwy
2012-06-08 13:40:27Ramchandra Aptesetmessageid: <1339162827.17.0.719830127875.issue13532@psf.upfronthosting.co.za>
2012-06-08 13:40:26Ramchandra Aptelinkissue13532 messages
2012-06-08 13:40:26Ramchandra Aptecreate