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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file frange-py-1.0.0.tar.gz.

File metadata

  • Download URL: frange-py-1.0.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for frange-py-1.0.0.tar.gz
Algorithm Hash digest
SHA256 aa7edd80a742f63cd34aac2c54ad6c61528df9658cd5d65297b3413281a05692
MD5 e0873effe09652929f0baa80aba30387
BLAKE2b-256 bb31d33459c33bd7e2805ba50e5576183c9127c05e5392da47a5c2b5e71fd40b

See more details on using hashes here.

File details

Details for the file frange_py-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: frange_py-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for frange_py-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3235543dbb1a508587e9f1a43ef2d1cc84ac5b0491c33aed1aaf45981a572e69
MD5 82b80be6a276ea078db0b543428fc853
BLAKE2b-256 ff8b022175ba97ef40a8b37e815e227e7f5799c150e049f0ae006e0aebe81aae

See more details on using hashes here.

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