The skip_last operator

The skip_last operator returns all items emitted by the source observable, but not the last n ones. The following figure shows the marble diagram of this operator:

Figure 9.6: The skip_last operator

The prototype of this operator is the following:

Observable.skip_last(self, count)

Here, count is the number of items to skip from the source observable.

Here is an example of this operator:

numbers = Observable.from_([1, 2, 3, 4, 5, 6])
numbers.skip_last(2).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 gives the following result:

on_next 1
on_next 2
on_next 3
on_next 4
on_completed
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.157.6