infinity
All-in-one infinity value for Python. Can be compared to any object.
What it is and what it does
infinity provides a single Infinity class that represents an infinity value comparable to any object in Python, addressing limitations of the built-in float('inf'). Unlike float infinity, the Infinity class supports rich comparisons with arbitrary types (e.g., datetime objects) and enforces mathematically correct behavior—for instance, pow(1, inf) raises TypeError rather than returning 1.
The package supports arithmetic operations (addition, subtraction, multiplication, division, exponentiation) with sensible semantics: inf + 3 returns inf, 5 / inf returns 0, but undefined operations like inf - inf or pow(1, inf) raise TypeError. It also coerces to float, string, and boolean types. However, the package has been abandoned since 2020 with no active maintenance.
Use it for:
- Implementing algorithms that need a universal upper or lower bound comparable to any type, not just numbers
- Creating priority queues or sorting logic where infinity must compare correctly with dates, strings, or custom objects
- Building mathematical or constraint-solving code that requires strict handling of undefined operations like inf - inf
- Replacing ad-hoc sentinel values (e.g., sys.maxsize) with a proper infinity abstraction
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides an Infinity class that can be compared to any object and supports arithmetic operations, offering a more flexible alternative to Python's built-in float('inf').
No. The package is abandoned (last release 2020-06-03, no commits since) and high install friction makes it a poor choice for new projects. Modern Python versions have better alternatives: use float('inf') for numeric comparisons, or implement a custom comparable wrapper for your specific type. Only consider it if you have legacy code already depending on it.
Install
infinity on PyPI
pip
pip install infinityuv
uv add infinitypoetry
poetry add infinityInstalling infinity
Before you install
High install friction due to source distribution format. Package is abandoned—last release was 2020-06-03 with no maintenance activity since. Use only if you cannot migrate to a maintained alternative.
License in practice
BSD license is permissive, allowing commercial and private use with minimal restrictions.
Quickstart
pip install infinity
from infinity import inf
print(3 < inf) # True
print(inf + 5) # inf
print(float(inf) == float('inf')) # True
Verify before relying
- Whether the package works reliably with Python versions beyond 3.5, given its abandoned status and age
- Whether arithmetic behavior matches mathematical conventions in all edge cases
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,263 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 182,955/month — #10,077 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: infinity-1.5.tar.gz
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
intervalsProvides Python classes for representing and…
permissive · top 15,000 on PyPI
trampolineEnables recursive functions to bypass Python's…
permissive · top 5,000 on PyPI
maybe-elseWraps values in a `Maybe` class to handle None…
permissive · top 15,000 on PyPI
python-rangesProvides Range, RangeSet, and RangeDict data…
permissive · top 15,000 on PyPI
portionportion provides data structures and operations…
copyleft · top 5,000 on PyPI
ordered-enumAdds comparison operators to Python enums so…
unclear · top 15,000 on PyPI
typepyTypepy checks, validates, and converts Python…
permissive · top 5,000 on PyPI
fastnumbersConverts strings and other inputs to numbers…
permissive · top 15,000 on PyPI
fixedintProvides fixed-width integer classes that…
permissive · top 5,000 on PyPI
consImplements Lisp/Scheme-style cons operations…
unclear · top 5,000 on PyPI