aioreactive
aioreactive copied to clipboard
rx.reduce should yield the initial value for an empty input
Operators on observables should act the same way as similar operators on collections. That includes emulating their behaviors for edge cases.
A reduce operator with an initial value on an empty list will return the initial value, so the same should apply to rx.reduce when applied to an empty observable – one that closes before emitting a value.
This can be achieved by emitting the initial value when the observable completes if no other value has been emitted.