You are here: Home Articles Python: Erlang-like pattern matching in Python

Python: Erlang-like pattern matching in Python

What?

Erlang is a bit of a hype now, because of its very light-weight concurrency model, which gets more and more important because of the many-core architecture of modern and future CPUs.

However, as noted by Ian Bicking in a blog post, the pattern matching is done quite easily in python, too.

That allows for having a generic dispatcher-like function which dispatches to registered handlers using pattern matching on the arguments of the dispatcher. Pretty nifty.

Document Actions