[Python-Dev] Symbolic errno values in error messages

Alexander Belopolsky alexander.belopolsky at gmail.com
Fri May 16 17:02:26 CEST 2008


On Fri, May 16, 2008 at 10:52 AM, Yannick Gingras <ygingras at ygingras.net> wrote:

>>>>> print e
>> [Errno 21] Is a directory
>>
>> So now I am not sure what OP is proposing.  Do you want to replace 21
>> with EISDIR in the above?
>
> Yes, that's what I had in mind.
>

In this case, I have a more drastic proposal.  Lets change
EnvironmentError errno attribute (myerrno in C) to string.  'EXYZ'
strings can be interned, which will make them more efficient than
integers for lookups and comparisons (to literals).  A half-way and
backward compatible solution would be to stick 'EXYZ' code at the end
of the args tuple and add an errnosym attribute.


More information about the Python-Dev mailing list