Reactive Programming in Python

in «tip» by Michael Beard
Tags: , , ,

Intro to Reactive Programming in Python

Here are several links (two are related - github and docs):

From the introduction article (the author also has a book that looks interesting - it is a link at the end of the article):

ReactiveX is a wonderful framework that allows to write event based code in a very elegant and readable way. Still, getting started in it can be challenging, and intimidating. In practice once you understand few key principles of ReactiveX, you can start writing reactive code easily.

and, from docs:

Reactive Extensions for Python (RxPY) is a set of libraries for composing asynchronous and event-based programs using observable sequences and pipable query operators in Python. Using Rx, developers represent asynchronous data streams with Observables, query asynchronous data streams using operators, and parameterize concurrency in data/event streams using Schedulers.

Using Rx, you can represent multiple asynchronous data streams (that come from diverse sources, e.g., stock quote, Tweets, computer events, web service requests, etc.), and subscribe to the event stream using the Observer object. The Observable notifies the subscribed Observer instance whenever an event occurs. You can put various transformations in-between the source Observable and the consuming Observer as well.

And, from the ReactiveX site itself:

Reactive Revolution ReactiveX is more than an API, it's an idea and a breakthrough in programming. It has inspired several other APIs, frameworks, and even programming languages.

Also, I like the symbols that are used in the articles. It makes much more sense as to how I always drew out flows - more data driven than code.

Anyway, cool thing.