Registry / serialization / infinity

infinity

JSON →
library1.5pypypi✓ verified 35d ago

The `infinity` library for Python provides a universal, all-in-one infinity value (`inf`) that can be compared to any other object, including numbers, lists, strings, and custom types, offering more flexible comparison behavior than `float('inf')`. It is currently at version 1.5 and has an infrequent release cadence for its stable feature set, reflecting its simple and focused utility.

serializationtesting
Install & Compatibility
Where this runs
tested against v1.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.5s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

The 'inf' object is a singleton and should be imported directly, not instantiated.

from infinity import inf

Demonstrates importing `inf` and its universal comparison capabilities with various data types, including numbers, strings, and collections, as well as accessing negative infinity.

from infinity import inf # Universal comparison print(f"inf > 1000: {inf > 1000}") print(f"inf < 1000: {inf < 1000}") print(f"inf == float('inf'): {inf == float('inf')}") # Compare with non-numeric types (unique feature of infinity.inf) print(f"inf > 'hello': {inf > 'hello'}") print(f"inf > []: {inf > []}") print(f"inf > {'a': 1}: {inf > {'a': 1}}") # Using negative infinity neg_inf = -inf print(f"neg_inf < -1000: {neg_inf < -1000}")
Debug
Known footguns
gotchaDo not confuse `infinity.inf` with `float('inf')` or `math.inf`. While `infinity.inf` is equal to `float('inf')`, it offers enhanced comparison capabilities against non-numeric types that standard Python floats do not support.
gotcha`infinity.inf` is implemented as a singleton object. There is only one instance of `inf` and `-inf`. You should not attempt to create new instances or modify its state.
gotchaWhile `infinity.inf` handles comparisons broadly, its interaction with `float('nan')` (Not a Number) can be inconsistent due to `NaN`'s unique comparison rules (e.g., `NaN == NaN` is False). Comparing `inf` with `NaN` might not always yield intuitive results.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
13 hits · last 30 days
gptbot
4
ahrefsbot
4
amazonbot
4
script
1
Resources