Skip to main content

Project Status: Active — The project has reached a stable, usable state and is being actively developed. CI Status coverage pyversions MIT License

GitHub | PyPI | Documentation | Issues | Changelog

permutation provides a Permutation class for representing permutations of finitely many positive integers in Python. Supported operations & properties include inverses, (group theoretic) order, parity, composition/multiplication, cycle decomposition, cycle notation, word representation, Lehmer codes, and, of course, use as a callable on integers.

Installation

permutation requires Python 3.8 or higher. Just use pip for Python 3 (You have pip, right?) to install:

python3 -m pip install permutation

Examples

>>> from permutation import Permutation
>>> p = Permutation(2, 1, 4, 5, 3)
>>> p(1)
2
>>> p(3)
4
>>> p(42)
42
>>> p.to_cycles()
[(1, 2), (3, 4, 5)]
>>> print(p)
(1 2)(3 4 5)
>>> print(p.inverse())
(1 2)(3 5 4)
>>> p.degree
5
>>> p.order
6
>>> p.is_even
False
>>> p.lehmer(5)
27
>>> q = Permutation.cycle(1,2,3)
>>> print(p * q)
(2 4 5 3)
>>> print(q * p)
(1 3 4 5)
>>> for p in Permutation.group(3):
...     print(p)
...
1
(1 2)
(2 3)
(1 3 2)
(1 2 3)
(1 3)

Metadata

Release files for permutation 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for permutation 0.5.0
File Size Uploaded Provenance Actions
permutation-0.5.0.tar.gz 16.5 kB Without provenance Details for permutation-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for permutation 0.5.0
File Interpreter ABI Platform Actions
permutation-0.5.0-py3-none-any.whl Python 3 none any Details for permutation-0.5.0-py3-none-any.whl

Total release size: 25.9 kB

Release files / permutation-0.5.0.tar.gz

Download URL permutation-0.5.0.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
568b94f68a466f424f7d18f3d5c6dee2ffad8052d4ad9ae5caae7c9a6ee0fbd7
BLAKE2b-256 checksum
How to use checksums
f34cb74d01cc99b8e2f13d77212e2b3a28966c70b09fd4963d5ad2e35a4df414
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.13.0

Release files / permutation-0.5.0-py3-none-any.whl

Download URL permutation-0.5.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e73566dd6cf337b158a281eb318bb57dc29ceace3e952242b746c9270b3c0ad8
BLAKE2b-256 checksum
How to use checksums
e772f0fbf48e0bfe09a2451e92ea03fdd988d0be39c5508b063415a71b1fac4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.13.0

Security for permutation 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page