Книга: Learning Concurrency in Python
Назад: Example
Дальше: Output

Breaking it down

What we've essentially done in the preceding code is create an observable that emits the result of i concatenated with Mississippi every 1,000 milliseconds. We then subscribed to these events with a very simple lambda function that simply prints out whatever has been emitted.

We included the call to input() in order to block until we wish to end the program. This is due to the fact that Observable.interval() operates on a separate thread, and without this call, our program would end somewhat prematurely.

Назад: Example
Дальше: Output