Skip to main content

Haskell-like intervals for Python

Project description

test codecov

lange

Lazy lists (i.e. Haskell-like ranges) for Python.

Features

  • Stable floating-point range generation, e.g.: 0.8 - 0.6 == 0.2 up to 28 digits (customizable).

Examples

Arithmetic Progression

# Forbidden syntax.
from lange import *
print(-[0.6, 0.8, ..., 2])
# [0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0]
# Conservative syntax.
from lange_ import a_
print(a_[0.6, 0.8, ..., 2])
# [0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0]
pr = a_[0.6, 0.8, ...]
print(pr[:5])
# [0.6 0.8 1.0 1.2 1.4]

Geometric Progression

# Forbidden syntax.
from lange import *
print(~[0.6, 0.8, ..., 2])
# [0.6 0.8 1.0666666666666667 1.4222222222222223 1.8962962962962964]
# Conservative syntax.
from lange_ import g_
print(g_[0.6, 0.8, ..., 2])
# [0.6 0.8 1.0666666666666667 1.4222222222222223 1.8962962962962964]
pr = g_[0.6, 0.8, ...]
print(pr[:5])
# [0.6 0.8 1.0666666666666667 1.4222222222222223 1.8962962962962964]

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

lange-0.2101.8.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

lange-0.2101.8-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file lange-0.2101.8.tar.gz.

File metadata

  • Download URL: lange-0.2101.8.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for lange-0.2101.8.tar.gz
Algorithm Hash digest
SHA256 59ebbd24e132db580defb7134551a370e18d10aba142a028c8a852f3184b079b
MD5 11fcd510e7bf945283bb3c58b51082e7
BLAKE2b-256 ef48a131c9558c8968c51e93a820e0c47be6e5534ab92edfc172e528ecabb317

See more details on using hashes here.

File details

Details for the file lange-0.2101.8-py3-none-any.whl.

File metadata

  • Download URL: lange-0.2101.8-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for lange-0.2101.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d3481a4df1ddb71a19a8f0be303cc16f49e5557d3b6c9f56b3c01c001f84a03a
MD5 360ddb8d30f058bb4e7055d5d6032b33
BLAKE2b-256 9e9d7291cb5067fb8ac97f93f0f97664fa2294db2b02c26bbfe9bfb41d750a00

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