import rx once = False def nope(i): global once print('try', i) if i == 2 and not once: once = True raise ValueError(i) return i s = rx.subjects.Subject() s.map(nope).retry().subscribe(print) s.on_next(1) s.on_next(2) s.on_next(3)