8000 GitHub - crate-py/rpds at v0.6.1
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

crate-py/rpds

Repository files navigation

rpds.py

PyPI version Supported Python versions Build status

Python bindings to the Rust rpds crate.

What's here is quite minimal (in transparency, it was written initially to support replacing pyrsistent in the referencing library). If you see something missing (which is very likely), a PR is definitely welcome to add it.

Methods in general are named similarly to their rpds counterparts (rather than pyrsistent's conventions, though probably a full drop-in pyrsistent-compatible wrapper module is a good addition at some point).

>>> from rpds import HashTrieMap, HashTrieSet, List

>>> m = HashTrieMap({"foo": "bar", "baz": "quux"})
>>> m.insert("spam", 37) == HashTrieMap({"foo": "bar", "baz": "quux", "spam": 37})
True
>>> m.remove("foo") == HashTrieMap({"baz": "quux"})
True

>>> s = HashTrieSet({"foo", "bar", "baz", "quux"})
>>> s.insert("spam") == HashTrieSet({"foo", "bar", "baz", "quux", "spam"})
True
>>> s.remove("foo") == HashTrieSet({"bar", "baz", "quux"})
True

>>> L = List([1, 3, 5])
>>> L.push_front(-1) == List([-1, 1, 3, 5])
True
>>> L.rest == List([3, 5])
True

About

Python bindings to the Rust rpds crate for persistent data structures

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Contributors 18

0