Skip to content
Immutable python data structures inspired by immutable.js
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
immutable
tests
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
LICENSE
MANIFEST.in
Makefile
Pipfile
README.rst
setup.cfg
setup.py
tox.ini

README.rst

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Femman27%2Fimmutapy.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Femman27%2Fimmutapy?ref=badge_shield)

Immutapy - Immutable data structures for Python

https://travis-ci.org/emman27/immutapy.svg?branch=master https://api.codacy.com/project/badge/Grade/5ccc6d4e7cf94c2ba1d7e24759852ae7

Immutapy is a library adding immutable data structures to Python to replace many of the standard library data structures. This is inspired by immutable.js and caused by mutable data structures generally just being a pain in the ass

Installing

Immutapy can be installed from pip. Supported (tested) versions of Python are 2.7, 3.4, 3.5 and 3.6, although most modern versions should be fine.

pip install immutapy

Usage

import immutable
lst = immutable.List()
new_list = lst.append(1)
# >> lst == immutable.List()
# True
# >> new_list == immutable.List([1])
# True

Features

  • ☐ Standard Library
    • ☑ List (Somewhat)
    • ☑ Dict
    • ☐ Set
  • ☐ collections
  • ☐ numpy

Performance Comparison

Note that immutable structures tend to have a performance overhead. Differences are highlighted in the table below.

Trivia: Python's standard library uses arrays to back lists. See https://wiki.python.org/moin/TimeComplexity

## License [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Femman27%2Fimmutapy.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Femman27%2Fimmutapy?ref=badge_large)

You can’t perform that action at this time.