Fix use of "either" and typo in "checking" (Jim Jewett)
This commit is contained in:
parent
32da320e75
commit
c842b6b33b
18
pep-3151.txt
18
pep-3151.txt
|
@ -83,12 +83,12 @@ caught but not IOError, or the reverse.
|
||||||
|
|
||||||
A further proof of the ambiguity of this segmentation is that the standard
|
A further proof of the ambiguity of this segmentation is that the standard
|
||||||
library itself sometimes has problems deciding. For example, in the
|
library itself sometimes has problems deciding. For example, in the
|
||||||
``select`` module, similar failures will raise either ``select.error``,
|
``select`` module, similar failures will raise ``select.error``, ``OSError``
|
||||||
``OSError`` or ``IOError`` depending on whether you are using select(),
|
or ``IOError`` depending on whether you are using select(), a poll object,
|
||||||
a poll object, a kqueue object, or an epoll object. This makes user code
|
a kqueue object, or an epoll object. This makes user code uselessly
|
||||||
uselessly complicated since it has to be prepared to catch various
|
complicated since it has to be prepared to catch various exception types,
|
||||||
exception types, depending on which exact implementation of a single
|
depending on which exact implementation of a single primitive it chooses
|
||||||
primitive it chooses to use at runtime.
|
to use at runtime.
|
||||||
|
|
||||||
As for WindowsError, it seems to be a pointless distinction. First, it
|
As for WindowsError, it seems to be a pointless distinction. First, it
|
||||||
only exists on Windows systems, which requires tedious compatibility code
|
only exists on Windows systems, which requires tedious compatibility code
|
||||||
|
@ -171,10 +171,10 @@ a narrower type of compatibility, which we will call *useful compatibility*.
|
||||||
|
|
||||||
For this we first must explain what we will call *careful* and *careless*
|
For this we first must explain what we will call *careful* and *careless*
|
||||||
exception handling. *Careless* (or "naïve") code is defined as code which
|
exception handling. *Careless* (or "naïve") code is defined as code which
|
||||||
blindly catches either of ``OSError``, ``IOError``, ``socket.error``,
|
blindly catches any of ``OSError``, ``IOError``, ``socket.error``,
|
||||||
``mmap.error``, ``WindowsError``, ``select.error`` without cheking the ``errno``
|
``mmap.error``, ``WindowsError``, ``select.error`` without checking the ``errno``
|
||||||
attribute. This is because such exception types are much too broad to signify
|
attribute. This is because such exception types are much too broad to signify
|
||||||
anything. Either of them can be raised for error conditions as diverse as: a
|
anything. Any of them can be raised for error conditions as diverse as: a
|
||||||
bad file descriptor (which will usually indicate a programming error), an
|
bad file descriptor (which will usually indicate a programming error), an
|
||||||
unconnected socket (ditto), a socket timeout, a file type mismatch, an invalid
|
unconnected socket (ditto), a socket timeout, a file type mismatch, an invalid
|
||||||
argument, a transmission failure, insufficient permissions, a non-existent
|
argument, a transmission failure, insufficient permissions, a non-existent
|
||||||
|
|
Loading…
Reference in New Issue