Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

generalized-range

A flexible Python generator function that extends the capabilities of Python's built-in range to all types, using customizable comparator and successor functions.

Installation

pip install generalized-range

Usage

# coding=utf-8
from __future__ import print_function
from generalized_range import generalized_range

for number in generalized_range(
    start=10,
    stop=14,
    step=1,
    comparator=lambda x, y: x < y,
    successor=lambda x: x + 1
):
    print(number)  # Output: 10, 11, 12, 13

for char in generalized_range(
    start='A',
    stop='F',
    step=2,
    comparator=lambda x, y: ord(x) < ord(y),
    successor=lambda x: chr(ord(x) + 1)
):
    print(char)  # Output: A, C, E

for number in generalized_range(
    start=5,
    stop=1,
    step=1,
    comparator=lambda x, y: x > y,
    successor=lambda x: x - 1
):
    print(number)  # Output: 5, 4, 3, 2

Contributing

If you find a bug or have a new feature you'd like to implement, please feel free to submit a pull request or open an issue.

License

This project is open-source and available under the MIT license. See the LICENSE file for more details.

Release files for generalized-range 0.1.0a0

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

Source distribution (sdist)

Source distribution for generalized-range 0.1.0a0
File Size Uploaded
generalized_range-0.1.0a0.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for generalized-range 0.1.0a0
File Interpreter ABI Platform
generalized_range-0.1.0a0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 6.7 kB

Release files / generalized_range-0.1.0a0.tar.gz

Download URL generalized_range-0.1.0a0.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5ed9130b3e7c23d03f2d9756dcfbb8bb4763c314b373215e57a4ab6fb35914df
BLAKE2b-256 checksum
How to use checksums
ebb5d51c41141788fd0f4d7f27046710c12334ef4d3cb152b687c991fdbf45d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release files / generalized_range-0.1.0a0-py2.py3-none-any.whl

Download URL generalized_range-0.1.0a0-py2.py3-none-any.whl
Size 3.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2c8de1ce7c8004e3032e74567dc850a248e2419ca97e81c04a7cbd1651ab0ade
BLAKE2b-256 checksum
How to use checksums
264cefbfa934f3a65afca54fc448667c562f40817bf925fe649fb5d50618de83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1.0a0 This release

2 release files

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