skillfed

infinity

All-in-one infinity value for Python. Can be compared to any object.

infinity v1.5 183.0K downloads/30d#10,077 on PyPI20
Permissive license BSD Abandoned released

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 infinity

uv

uv add infinity

poetry

poetry add infinity

Installing 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

Environment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software Development :: Libraries :: Python Modules

Tags

infinity value comparisoninfinite number pythoncomparable infinity objectarithmetic with infinityinf class implementation
numeric-sentinelcomparison-protocol

More Python Modules packages