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

The merge_all() operator

Another option to combine your observables is to use the merge_all() operator in order to merge two or more distinct observables into one observable that we can subscribe to.

In this example, we'll define two very simple observables from two arrays of numbers. We will then create an array of observables that we'll call "sources" and subsequently use the merge_all() operator on this newly created array in order to combine them all into an amalgamation of all of our two original observables:

from rx import Observable

list1 = [23, 38, 43, 23]
list2 = [1,2,3,4]
source1 = Observable.from_(list1)
source2 = Observable.from_(list2)
sources = [source1, source2]

def main():
Observable.from_(sources) \
.merge_all() \
.subscribe(lambda x: print(x))
if __name__ == '__main__':
main()
input("Press any key to quit\n")
Назад: Output
Дальше: 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.
Carrieor
Carrie Underwood is my favourite country singer. She is young, beautiful and charming female in her 30s. Her strong voice takes me away from all troubles of this world so I start enjoy my life and listen songs created by her mind. Now the singer is on a Cry Pretty 360 Tour started in May of 2019. The concerts scheduled for this year, up to the 31st of October. Tickets are available for all men and women with different income. If you love country music as mush as I, then you must visit at least one of her concert. All tour dates are available at the Carrie Underwood tour Pittsburgh. Visit the website and make yourself familiar with all powerful Carrie Underwood concerts in 2019!
fff
fffffff