Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

discussion edits

  • Loading branch information...
commit 5e0d8a86d77e0cde262c03974970e0d22e7e529a 1 parent 4b27a51
@wardi authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 Iterables, Iterators, Generators.ipynb
View
4 Iterables, Iterators, Generators.ipynb
@@ -2305,7 +2305,7 @@
"\n",
"The caller is responsible for receiving input from the users, sending output to the users and informing the generator when the opponent connects, disconnects or has timed out. The disconnect and timeout conditions are somewhat exceptional so they have been implemented with the use of the generator's `.throw()` method.\n",
"\n",
- "Exceptions passed to a generator's `.throw()` method are raised *within the generator* from the current `yield` statement, just like how the `.close()` method raises `GeneratorExit`. Exceptions may then be handled by the generator with `try:` `except:`. Here we handle the exceptions by printing a message and returning to the outer `while:` loop (the \"waiting\" state)."
+ "Exceptions passed to a generator's `.throw()` method are raised *within the generator* from the current `yield` statement, just like how the `.close()` method raises `GeneratorExit`. Exceptions may then be handled by the generator with `try:` `except:` blocks. Here we handle the exceptions by printing a message and returning to the outer `while:` loop (the \"waiting\" state)."
]
},
{
@@ -2681,7 +2681,7 @@
"\n",
"Now we need to pull all the peices together in a way that a `select.select()` loop can run the whole thing.\n",
"\n",
- "This generator accepts input on the console for player 0 with `cbreak_keys()`, and listens on a TCP port for player 1 to connect. When player 1 connects it accepts input on that socket as a telnet connection with `telnet_keys()`. Input from both players is forwarded to `game_machine()`. When `game_machine()` asks for the timer to be reset this generator creates a `countdown_generator()` that will be used to give player 1 a countdown as their time is running out.\n",
+ "This generator accepts input on the console for player 0 with `cbreak_keys()`, and listens on a TCP port for player 1 (the guest) to connect. When player 1 connects it accepts input on that socket as a telnet connection with `telnet_keys()`. Input from both players is forwarded to `game_machine()`. When `game_machine()` asks for the timer to be reset this generator creates a `countdown_generator()` that will be used to give player 1 a countdown as their time is running out.\n",
"\n",
"The caller is expected to be running `select.select()` in a loop. `select.select()` expects a list of file descriptors that might have data waiting and optionally a timeout value. The file descriptors passed will either be the console and server socket when player 1 is not connected, or the console and the client socket when player 1 is connected. The timeout will be set if there is a countdown in progress. `select.select()` yields a list of the file descriptors that are readable, or an empty list if the timeout was reached."
]
Please sign in to comment.
Something went wrong with that request. Please try again.