Message3202

Author leosoto
Recipients leosoto
Date 2008-05-25.05:50:16
SpamBayes Score 0.0775008
Marked as misclassified No
Message-id <1211694630.43.0.601029034042.issue1040@psf.upfronthosting.co.za>
In-reply-to
Content
On CPython, KeyError.__str__ is special, because it uses repr() of the
exception argument instead of str(). Here is the reason, from  exceptions.c:

       If args is a tuple of exactly one item, apply repr to args[0].
       This is done so that e.g. the exception raised by {}[''] prints
         KeyError: ''
       rather than the confusing
         KeyError
       alone.  The downside is that if KeyError is raised with an
explanatory
       string, that string will be displayed in quotes.  Too bad.
       If args is anything else, use the default BaseException__str__().

Currently, Jython doesn't match this behaviour.
History
Date User Action Args
2008-05-25 05:50:33leosotosetspambayes_score: 0.0775008 -> 0.0775008
recipients: + leosoto
2008-05-25 05:50:31leosotosetspambayes_score: 0.0775008 -> 0.0775008
messageid: <1211694630.43.0.601029034042.issue1040@psf.upfronthosting.co.za>
2008-05-25 05:50:29leosotolinkissue1040 messages
2008-05-25 05:50:29leosotocreate