Skip to main content

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


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)

Uploaded Source

Built Distribution

frange_py-1.0.0-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page