This library includes experimental bindings that provide efficient immutable vectors for the Python language. They were developed as part of the research for the ICFP‘17 paper. The interface is quite incomplete, yet you can already do some things like:
import immer
v0 = immer.Vector().append(13).append(42)
assert v0[0] == 13
assert v0[1] == 42
assert len(v0) == 2
v1 = v0.set(0, 12)
assert v0.tolist() == [13, 42]
assert v1.tolist() == [12, 42]
Do you want to help making these bindings complete and production ready? Drop a line at immer@sinusoid.al or open an issue on GitHub
pip install --user git+https://github.com/arximboldi/immer.git
The library includes a set of benchmarks that compare it to pyrsistent. You can see the results in the ICFP‘17 paper. If you want to run them yourself, you need to install some dependencies:
pip install --user pytest-benchmark pyrsistent
Then you need to clone the project repository and from its root, run:
pytest extra/python/benchmark