multiset
An implementation of a multiset.
Decision gist · record as of 2026-08-14
Yes, if you need set operations on collections with duplicates. The package is stable, has zero dependencies, and installs easily. However, maintenance is dormant (last release 717 days ago), so consider whether you need active support or can rely on a mature, unchanging implementation. For simple frequency counting, collections.Counter may be sufficient; reach for multiset when you specifically need set semantics with duplicates.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later.
- Low friction: pure Python wheel with no runtime dependencies.
- Maintenance is dormant—last release was 717 days ago—but the repository is not archived and the package is marked Production/Stable with support for current Python versions (3.8 through 3.12).
License · maintenance · safety
MIT (permissive) — MIT license (permissive) imposes no restrictions on use, modification, or redistribution in proprietary or open-source projects.
last release 2024-08-27 (717 days) · last repo commit 2024-08-27 · 39 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 453,051 downloads/mo, #6,578 on PyPI
Alternatives
Verify before relying
from multiset import Multiset, FrozenMultiset
set1 = Multiset('aab')
set2 = Multiset('abc')
result = sorted(set1 | set2) # ['a', 'a', 'b', 'c']
frozen = FrozenMultiset('abc')
hash(frozen) # hashable- Performance characteristics compared to collections.Counter or repeated set operations for large datasets
- Whether the API is fully stable or if breaking changes are possible despite dormant maintenance status
What it is and what it does
Multiset is a data structure that extends Python's built-in set to allow elements to appear multiple times. Like a set, it requires elements to be hashable and supports the same operations—membership tests, union, intersection, symmetric difference—but tracks how many times each element occurs. The package provides both a mutable Multiset class and an immutable FrozenMultiset (similar to frozenset) that is also hashable.
Unlike collections.Counter from the standard library, multiset enforces proper set semantics: it only allows positive counts, automatically removes elements with zero multiplicity, and supports all standard set operations without treating the collection as a frequency counter. The implementation uses a dictionary internally to map elements to their counts, making it suitable for algorithms that need set operations on collections with duplicates.
Use it for
- Counting occurrences of hashable items while performing set operations like union or intersection
- Implementing algorithms that require multiset semantics (e.g., graph theory, combinatorics) where duplicate membership matters
- Using multisets as dictionary keys or in sets by wrapping them in FrozenMultiset for immutability and hashability
- Comparing collections where element frequency and set relationships both matter (e.g., checking if one multiset is a sub-multiset of another)
- Replacing ad-hoc Counter-based logic when you need proper set operations rather than frequency counting
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need set operations on collections with duplicates.
The package is stable, has zero dependencies, and installs easily. However, maintenance is dormant (last release 717 days ago), so consider whether you need active support or can rely on a mature, unchanging implementation. For simple frequency counting, collections.Counter may be sufficient; reach for multiset when you specifically need set semantics with duplicates.
Install
multiset on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance is dormant—last release was 717 days ago—but the repository is not archived and the package is marked Production/Stable with support for current Python versions (3.8 through 3.12).
Requires Python 3.8 or later.
License in practice
MIT license (permissive) imposes no restrictions on use, modification, or redistribution in proprietary or open-source projects.
Quickstart
from multiset import Multiset, FrozenMultiset
set1 = Multiset('aab')
set2 = Multiset('abc')
result = sorted(set1 | set2) # ['a', 'a', 'b', 'c']
frozen = FrozenMultiset('abc')
hash(frozen) # hashable
Verify before relying
- Performance characteristics compared to collections.Counter or repeated set operations for large datasets
- Whether the API is fully stable or if breaking changes are possible despite dormant maintenance status
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 717 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 453,051 / month, #6,578 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: multiset-3.2.0-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “multiset data structure”
- multisetProvides a mutable and immutable multiset data structure that extends…
- collections-extendedProvides four specialized collection types—bag (multiset), setlist…
- mmtf-pythonDecodes and encodes the macromolecular transmission format (MMTF), a…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also collections-extended · orderly-set · immutables · frozenlist · frozendict · ordered-set · portion · pyrsistent · permutation · HeapDict