Skip to main content

frange: An alternative to range with support for floats

Requirements

Python 3.6>=

Installation

# Linux
python3 -m pip install frange-py
# Windows
python -m pip install frange-py

Usage

import frange

frange.frange(10.0) # frange(0, 10, 1)
frange.frange(0.5, 10.5) # frange(0.5, 10.5, 1)
len(frange.frange(0.5, 10.5)) # 10
frange.frange(0.5, 10.5)[0] # 0.5
frange.frange(0.5, 10.5)[-1] # 9.5
frange.frange(0.5, 10.5)[1:5] # frange(1.5, 5.5)
for i in frange.frange(0.5, 10.5):
    print(i) 
"""
0.5
1.5
2.5
3.5
4.5
5.5
6.5
7.5
8.5
9.5
"""

Monkey patching the built-in range function

from frange import frange as range

To Do

  • Rewrite in C

Release files for frange-py 1.0.0

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

Source distribution (sdist)

Source distribution for frange-py 1.0.0
File Size Uploaded
frange-py-1.0.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for frange-py 1.0.0
File Interpreter ABI Platform
frange_py-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.3 kB

Release files / frange-py-1.0.0.tar.gz

Download URL frange-py-1.0.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aa7edd80a742f63cd34aac2c54ad6c61528df9658cd5d65297b3413281a05692
BLAKE2b-256 checksum
How to use checksums
bb31d33459c33bd7e2805ba50e5576183c9127c05e5392da47a5c2b5e71fd40b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / frange_py-1.0.0-py3-none-any.whl

Download URL frange_py-1.0.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3235543dbb1a508587e9f1a43ef2d1cc84ac5b0491c33aed1aaf45981a572e69
BLAKE2b-256 checksum
How to use checksums
ff8b022175ba97ef40a8b37e815e227e7f5799c150e049f0ae006e0aebe81aae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.0.0 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