.. include:: operator-aliases.rst .. testsetup:: default import rx .. currentmodule:: rx .. _operator-header-combine_latest: .. _operator-header-with_latest_from: Combine latest ============== .. seealso:: - |zip| - Official ReactiveX documentation: `CombineLatest `_ - RxPY marbles: |operator-marbles-combine_latest| - RxPY marbles: |operator-marbles-with_latest_from| .. _operator-combine_latest: .. automethod:: Observable.combine_latest .. image:: /img/reactivex/operators/combineLatest.png :align: center .. doctest:: >>> from rx.testing import marbles >>> xs = rx.Observable.from_marbles('1-2-3-4-|') >>> ys = rx.Observable.from_marbles('-a-b-c-d-e|') >>> source = xs.combine_latest(ys, lambda x, y: x+y) >>> subscription = source.subscribe( ... lambda value: print("Next:", value), ... lambda error: print("Error:", error), ... lambda: print("Complete!")) Next: 2a Next: 3a Next: 3b Next: 4b Next: 4c Next: 4d Next: 4e Complete! .. _operator-with_latest_from: .. automethod:: Observable.with_latest_from .. image:: /img/reactivex/operators/withLatestFrom.png :align: center .. doctest:: >>> from rx.testing import marbles >>> xs = rx.Observable.from_marbles('1--2-3-4-|') >>> ys = rx.Observable.from_marbles('-a-b-c-d-e|') >>> source = xs.combine_latest(ys, lambda x, y: x+y) >>> subscription = source.subscribe( ... lambda value: print("Next:", value), ... lambda error: print("Error:", error), ... lambda: print("Complete!")) Next: 2a Next: 3b Next: 4c Complete!