|
|
|
|
|
by athanagor2
830 days ago
|
|
Handling user inputs.
Each time the generator yields you wait for a user input, and when you receive it you next() the generator with the input. It’s less verbose than using a bunch of methods, or the closest alternative I saw which is a switch/case on the index of the current operation. By using generators you just reuse the standard structures of the language. |
|