An alternative to range with support for floats
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
frange-py-1.0.0.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for frange_py-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3235543dbb1a508587e9f1a43ef2d1cc84ac5b0491c33aed1aaf45981a572e69 |
|
MD5 | 82b80be6a276ea078db0b543428fc853 |
|
BLAKE2b-256 | ff8b022175ba97ef40a8b37e815e227e7f5799c150e049f0ae006e0aebe81aae |