[Python-Dev] OSError.errno => exception hierarchy? (original) (raw)
Amaury Forgeot d'Arc amauryfa at gmail.com
Thu Apr 2 23:27:20 CEST 2009
- Previous message: [Python-Dev] OSError.errno => exception hierarchy?
- Next message: [Python-Dev] Let's update CObject API so it is safe and regular!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello,
On Thu, Apr 2, 2009 at 22:35, Jack diederich <jackdied at gmail.com> wrote:
On Thu, Apr 2, 2009 at 4:25 PM, Benjamin Peterson <benjamin at python.org> wrote:
2009/4/2 Gustavo Carneiro <gjcarneiro at gmail.com>:
Apologies if this has already been discussed.
I don't believe it has ever been discussed to be implemented.
Apparently no one has bothered yet to turn OSError + errno into a hierarchy of OSError subclasses, as it should. What's the problem, no will to do it, or no manpower? Python doesn't need any more builtin exceptions to clutter the namespace. Besides, what's wrong with just checking the errno? The problem is manpower (this has been no ones itch). In order to have a hierarchy of OSError exceptions the underlying code would have to raise them. That means diving into all the C code that raises OSError and cleaning them up. I'm +1 on the idea but -1 on doing the work myself. -Jack
The py library (http://codespeak.net/py/dist/) already has a py.error module that provide an exception class for each errno. See for example how they use py.error.ENOENT, py.error.EACCES... to implement some kind of FilePath object: http://codespeak.net/svn/py/dist/py/path/local/local.py
But I'm not sure I would like this kind of code in core python. Too much magic...
-- Amaury Forgeot d'Arc
- Previous message: [Python-Dev] OSError.errno => exception hierarchy?
- Next message: [Python-Dev] Let's update CObject API so it is safe and regular!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]