Skip to content

Immutable python data structures inspired by immutable.js

License

Notifications You must be signed in to change notification settings

emman27/immutapy

Repository files navigation

[![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)

About

Immutable python data structures inspired by immutable.js

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published