Unhelpful error message

Terry Reedy tjreedy at udel.edu
Tue Jun 6 17:28:47 EDT 2017


On 6/6/2017 2:29 PM, Chris Angelico wrote:
> On Wed, Jun 7, 2017 at 4:22 AM, Skip Montanaro <skip.montanaro at gmail.com> wrote:
>> On Tue, Jun 6, 2017 at 12:27 PM, Chris Angelico <rosuav at gmail.com> wrote:
>>> Or perhaps showing the repr of the string would be clearer.
>>
>> This would definitely be better, I think, and require no special
>> casing of the empty string. Still, I doubt this would ever be
>> backported for fear of breaking code might be out there somewhere
>> which relies on the current behavior. At best, it might be added to
>> the next 3.x release (3.7?).
> 
> Yeah. Unfortunately this exception doesn't make good use of its args,
> so you can't get programmatic information from it (this is true in 3.7
> too actually). So if a change were to be made, I'd recommend putting
> the actual string into e.args[1] or something, and then the message
> shouldn't need to be parsed. I'm not sure what the backward compat
> guarantees on exception messages are, though, so it is possible that
> this might be changed in 2.7.

Unless a message is erroneous (buggy), it is usually treated as an 
enhancement.

-- 
Terry Jan Reedy




More information about the Python-list mailing list