Why does Python's os
module contain error
, an alias for OSError
?
Is there a reason to ever spell it os.error
? OSError
certainly seems more consistent with all the other built-in exceptions.
I hoped os.py
would shed some light, but it uses error
sometimes and OSError
others.
It seems goofy to have an extra name for one of the exceptions, yet it survives into Python 3.0. What am I missing?
The documentation for OSError
says that it was added in version 1.5.2. My guess is that error
predates this a little and in an effort to remain backwards-compatible to code written for Python before 1.5.2 error
was made an alias for OSError
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With