I just installed RxPy the Reactive extensions for Python, as you may guess from the title of this article. Well, that was easy. What next? Here’s a delightfully short program which does — ahem — something:
import sys import rx rx.Observable.from_(sys.stdin).subscribe(print)
It echoes stdin to stdout. Kinda.
- There are more newlines than I was expecting — an extra one after each line is echoed
- The single line is actually an expression returning a Disposable that you can use to unsubscribe. I’m discarding it.
- I have syntastic installed in Vim and pylint complains of a syntax error when I pass
subscribeso perhaps I need to configure it to know about python3.