Skip to content

mlenzen/collections-extended

Repository files navigation

README

Coverage

Downloads

Documentation:

https://collections-extended.lenzm.net/

GitHub:

https://github.com/mlenzen/collections-extended

PyPI:

https://pypi.python.org/pypi/collections-extended

Overview

collections_extended is a pure Python module with no dependencies providing extra collections. The new collections include bags AKA multisets, setlists AKA unique lists or ordered sets, a bijection, a RangeMap which is a mapping from ranges to values, and an IndexedDict class. There are also frozen (hashable) varieties of bags and setlists.

Compatible with and tested against CPython 3.6, 3.7, 3.8, 3.9, 3.10, PyPy3.6, PyPy3.7 & PyPy3.8.

Getting Started

Installation

pip install collections-extended

Usage

from collections_extended import bag, frozenbag, setlist, frozensetlist, bijection

New Collections

There are seven new collections provided:

Bags

bag

This is a bag AKA multiset.

frozenbag

This is a frozen (hashable) version of a bag.

Setlists

setlist

An ordered set or a list of unique elements depending on how you look at it.

frozensetlist

This is a frozen (hashable) version of a setlist.

Mappings

bijection

A one-to-one mapping.

RangeMap

A mapping from ranges (of numbers/dates/etc)

IndexedDict

A mapping that keeps insertion order and allows access by index.

Python 2

The package no longer supports Python 2. The last version to support Python 2.7, 3.4 & 3.5 was 1.0. No new feature releases will be done for 1.x but any significant bugs that come up may be fixed.

Author

Michael Lenzen

Copyright

2022 Michael Lenzen

License

Apache License, Version 2.0

Project Homepage

https://github.com/mlenzen/collections-extended

About

Extra Python Collections - bags (multisets), setlists (unique list / indexed set), RangeMap and IndexedDict

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published