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: