[Python-Dev] win32 specific exception in the core?

Tim Peters tim_one@email.msn.com
Mon, 7 Feb 2000 04:11:02 -0500

> any reason you can't just throw OSError exceptions?

> Mainly cos the error numbers are different - (eg, compare "errno.h" with
> "winerror.h" OSError really should be named CRTError.

There's nothing to stop a new CRTError class being derived from OSError,
leaving OSError platform-neutral.  This would just be vanilla OO refactoring
in the face of new requirements, and existing code wouldn't know the

You should subclass from OSError so that code that cares about portability
can catch OSError specifically instead of needing to be modified every time
someone with a new OS wants to add a class of error specific to that OS.

> I dont think it makes much sense to have 2 different error numbering
> schemes use the same exception...

No, I agree that does not.  But it makes perfect sense for a subclass to
override its parent's numbering scheme (and even more sense to make
"numbering scheme" an abstract property of the parent to be implemented by
its subclasses).