[Python-Dev] Proposed resolutions for open PEP 343 issues (original) (raw)
Michael Chermside mcherm at mcherm.com
Wed Oct 26 17:32:46 CEST 2005
- Previous message: [Python-Dev] make testall hanging on HEAD?
- Next message: [Python-Dev] Proposed resolutions for open PEP 343 issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido writes:
I find "AttributeError: exit" just as informative.
Eric Nieuwland responds:
I see. Then why don't we unify *Error into Error? Just read the message and know what it means. And we could then drop the burden of exception classes and only use the message. A sense of deja-vu comes over me somehow ;-)
The answer (and there IS an answer) is that using different exception types allows the user some flexibility in CATCHING the exceptions. The discussion you have been following obscures that point somewhat because there's little meaningful difference between TypeError and AttributeError (at least in well-written code that doesn't have unnecessary typechecks in it).
If there were a significant difference between TypeError and AttributeError then Nick and Guido would have immediately chosen the appropriate error type based on functionality rather than style, and there wouldn't have been any need for discussion.
Oh yeah, and you can also put extra info into an exception object besides just the error message. (We don't do that as often as we should... it's a powerful technique.)
-- Michael Chermside
- Previous message: [Python-Dev] make testall hanging on HEAD?
- Next message: [Python-Dev] Proposed resolutions for open PEP 343 issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]