Created
December 12, 2016 09:31
-
-
Save lafras/c7179d9acf8ff962b1a11f2b72c4224e to your computer and use it in GitHub Desktop.
Finally figured out this Reactive X subject thing...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rx | |
obs = rx.Observable.range(0,10) | |
sub = rx.subjects.Subject() | |
square = sub.map( | |
lambda x: 'i am square: {}'.format(x**2) | |
) | |
cube = sub.map( | |
lambda x: 'i am cube: {}'.format(x**3) | |
) | |
square.subscribe(print) | |
cube.subscribe(print) | |
obs.subscribe(sub) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment