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

Zip() example

In this example, we'll use the .zip() operator in order to combine both the letters Observable as well as the intervals Observable into one Observable. Then, we will use the .subscribe() operator in order to subscribe a very simple Observer to this newly combined Observable object:

from rx import Observable


list1 = [23, 38, 43, 23]

letters = Observable.from_(list1).to_blocking()
intervals = Observable.interval(1000)

def main():
Observable \
.zip(letters, intervals, lambda x, y: (x*y, y))
\
.subscribe(lambda t: print(t))

if __name__ == '__main__':
main()
input("Press any key to quit\n")
Назад: Combining observables
Дальше: Output

MaxPowermuh
Download missing dll from Download unarc.dll page. Fix your error now!
Kimeror
Interested in hardrock? How about KISS? They are on a tour this year all across Canada and USA. Visit KISS Tour Dates Omaha to know more about KISS concert dates in 2019.