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 vencabot_teppoo
Recipients Julian, amaury.forgeotdarc, belopolsky, eric.araujo, lukasz.langa, pitrou, rharris, vencabot_teppoo
Date 2012-02-23.03:14:15
SpamBayes Score 1.0370627e-08
Marked as misclassified No
Message-id <1329966856.43.0.369862099403.issue2651@psf.upfronthosting.co.za>
In-reply-to
Content
I'm +1 for fixing this behavior for the same reasons that are mentioned in the OP: consistency and predictability. I raised this issue as #14086, and I was referred to this issue before closing mine as a duplicate.

It took me a while to figure out why I was getting unexpected escaped quotation marks in my strings, and it turned out that it was because I was passing strings back and forth as Exception arguments (tagging built-in Exceptions with a little bit of extra information when they occurred and re-raising), and every time that it occurred with a KeyError (and only with a KeyError), the string would grow another pair of quotation marks.

In my issue, I bring up the documentation in the Python Tutorial about Exception.args and Exception.__str__(); it states very plainly and simply (as it should be) that the __str__() method is there to be able to conveniently print Exception arguments without calling .args, and, when an unhandled Exception stops Python, the tail-end of the message (the details) of the exception will be the arguments that it was given. This is not the case with KeyError.

str(KeyError("Foo")) should be equal to "Foo", as it would be with any other Exception and as is the documented behavior of built-in Exceptions, at least in the tutorial (which I realize isn't the be-all, end-all document). The documented behavior makes more sense.
History
Date User Action Args
2012-02-23 03:14:16vencabot_teppoosetrecipients: + vencabot_teppoo, amaury.forgeotdarc, belopolsky, pitrou, rharris, eric.araujo, lukasz.langa, Julian
2012-02-23 03:14:16vencabot_teppoosetmessageid: <1329966856.43.0.369862099403.issue2651@psf.upfronthosting.co.za>
2012-02-23 03:14:15vencabot_teppoolinkissue2651 messages
2012-02-23 03:14:15vencabot_teppoocreate