PEP 554: Return a boolean from send_nowait() rather than raising an exception. (#987)
This commit is contained in:
parent
7bd1bc2c9e
commit
b7f089015a
40
pep-0554.rst
40
pep-0554.rst
|
@ -139,32 +139,33 @@ For sharing data between interpreters:
|
||||||
|
|
||||||
|
|
|
|
||||||
|
|
||||||
+------------------------------+-------------------------------------------------+
|
+------------------------------+--------------------------------------------------+
|
||||||
| signature | description |
|
| signature | description |
|
||||||
+==============================+=================================================+
|
+==============================+==================================================+
|
||||||
| ``class SendChannel(id)`` | The sending end of a channel. |
|
| ``class SendChannel(id)`` | The sending end of a channel. |
|
||||||
+------------------------------+-------------------------------------------------+
|
+------------------------------+--------------------------------------------------+
|
||||||
| ``.id`` | The channel's unique ID. |
|
| ``.id`` | The channel's unique ID. |
|
||||||
+------------------------------+-------------------------------------------------+
|
+------------------------------+--------------------------------------------------+
|
||||||
| ``.interpreters`` | The list of associated interpreters. |
|
| ``.interpreters`` | The list of associated interpreters. |
|
||||||
+------------------------------+-------------------------------------------------+
|
+------------------------------+--------------------------------------------------+
|
||||||
| ``.send(obj)`` | | Send the object (i.e. its data) to the |
|
| ``.send(obj)`` | | Send the object (i.e. its data) to the |
|
||||||
| | | receiving end of the channel and wait. |
|
| | | receiving end of the channel and wait. |
|
||||||
| | | Associate the interpreter with the channel. |
|
| | | Associate the interpreter with the channel. |
|
||||||
+------------------------------+-------------------------------------------------+
|
+------------------------------+--------------------------------------------------+
|
||||||
| ``.send_nowait(obj)`` | | Like send(), but fail if not received. |
|
| ``.send_nowait(obj)`` | | Like send(), but return False if not received. |
|
||||||
+------------------------------+-------------------------------------------------+
|
+------------------------------+--------------------------------------------------+
|
||||||
| ``.send_buffer(obj)`` | | Send the object's (PEP 3118) buffer to the |
|
| ``.send_buffer(obj)`` | | Send the object's (PEP 3118) buffer to the |
|
||||||
| | | receiving end of the channel and wait. |
|
| | | receiving end of the channel and wait. |
|
||||||
| | | Associate the interpreter with the channel. |
|
| | | Associate the interpreter with the channel. |
|
||||||
+------------------------------+-------------------------------------------------+
|
+------------------------------+--------------------------------------------------+
|
||||||
| ``.send_buffer_nowait(obj)`` | | Like send_buffer(), but fail if not received. |
|
| ``.send_buffer_nowait(obj)`` | | Like send_buffer(), but return False |
|
||||||
+------------------------------+-------------------------------------------------+
|
| | | if not received. |
|
||||||
|
+------------------------------+--------------------------------------------------+
|
||||||
| ``.release()`` | | No longer associate the current interpreter |
|
| ``.release()`` | | No longer associate the current interpreter |
|
||||||
| | | with the channel (on the sending end). |
|
| | | with the channel (on the sending end). |
|
||||||
+------------------------------+-------------------------------------------------+
|
+------------------------------+--------------------------------------------------+
|
||||||
| ``.close(force=False)`` | | Close the channel in all interpreters. |
|
| ``.close(force=False)`` | | Close the channel in all interpreters. |
|
||||||
+------------------------------+-------------------------------------------------+
|
+------------------------------+--------------------------------------------------+
|
||||||
|
|
||||||
|
|
|
|
||||||
|
|
||||||
|
@ -938,10 +939,10 @@ The module also provides the following channel-related classes::
|
||||||
|
|
||||||
send_nowait(obj):
|
send_nowait(obj):
|
||||||
|
|
||||||
Send the object to the "recv" end of the channel. If no
|
Send the object to the "recv" end of the channel. This
|
||||||
interpreter is currently receiving (waiting on the other
|
behaves the same as "send()", except for the waiting part.
|
||||||
end) then raise NotReceivedError. Otherwise this is the
|
If no interpreter is currently receiving (waiting on the
|
||||||
same as "send()".
|
other end) then return False. Otherwise return True.
|
||||||
|
|
||||||
send_buffer(obj):
|
send_buffer(obj):
|
||||||
|
|
||||||
|
@ -952,9 +953,8 @@ The module also provides the following channel-related classes::
|
||||||
send_buffer_nowait(obj):
|
send_buffer_nowait(obj):
|
||||||
|
|
||||||
Send a MemoryView of the object rather than the object.
|
Send a MemoryView of the object rather than the object.
|
||||||
If the other end is not currently receiving then raise
|
If the other end is not currently receiving then return
|
||||||
NotReceivedError. Otherwise this is the same as
|
False. Otherwise return True.
|
||||||
"send_buffer()".
|
|
||||||
|
|
||||||
release():
|
release():
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue