'Returning an item after completed streaming items in a stream (list) in RxPy

is it possible to switch a stream of list items to emit an item at the completion of do_action

for example :

def add_hobbies(a_student, hobbies):
    return hobbies.pipe(
        op.do_action(lambda h: add_hobby(a_student, h)),
    )

add_hobbies() will emit items in hobbies stream. I want at the end of hobbies stream, it emits a_student.

I try this but it returns : 'Observable' object is not callable

def add_hobbies(a_student, hobbies):
    return hobbies.pipe(
        op.do_action(lambda h: add_hobby(a_student, h), on_completed=rx.of(a_student)),
    )

Many thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source