The zip_list operator behaves like the zip operator, but its output items are lists instead of a combination of the source items. Each list item contains all items emitted by the source observables. The following figure shows the marble diagram of the zip_list operator:
Figure 9.16: The zip_list operator
Its prototype is the following:
Observable.zip_list(cls, *args)
Here, all the observables to be combined are provided as arguments.
Here is an example of the zip_list operator:
numbers = Observable.from_([1, 2, 3, 4])
characters = Observable.from_(['a', 'b', 'c', 'd' ,'e'])
Observable.zip_list(characters, numbers).subscribe(
on_next = lambda i: print("on_next {}".format(i)),
on_error = lambda e: print("on_error: {}".format(e)),
on_completed = lambda: print("on_completed")
)
This example gives the following result: