[Python-Dev] Symbolic errno values in error messages (original) (raw)
M.-A. Lemburg mal at egenix.com
Fri May 16 17:35:37 CEST 2008
- Previous message: [Python-Dev] Symbolic errno values in error messages
- Next message: [Python-Dev] Symbolic errno values in error messages
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2008-05-16 17:02, Alexander Belopolsky wrote:
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.
-1
You never want to change an integer field to a 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.
Actually, you don't have to put it into any tuple. Just add it to the error object as attribute.
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Source (#1, May 16 2008)
Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
- Previous message: [Python-Dev] Symbolic errno values in error messages
- Next message: [Python-Dev] Symbolic errno values in error messages
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]