Haskell-like intervals for Python
Project description
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.
import lange
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.
import lange
print(~[0.4, 0.8, ..., 2])
# [0.4 0.8 1.6]
# Conservative syntax.
from lange_ import g_
print(g_[0.4, 0.8, ..., 2])
# [0.4 0.8 1.6]
pr = g_[0.4, 0.8, ...]
print(pr[:5])
# [0.4 0.8 1.6 3.2 6.4]
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
lange-0.2101.13.tar.gz
(5.9 kB
view details)
Built Distribution
lange-0.2101.13-py3-none-any.whl
(19.2 kB
view details)
File details
Details for the file lange-0.2101.13.tar.gz
.
File metadata
- Download URL: lange-0.2101.13.tar.gz
- Upload date:
- Size: 5.9 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4477bbf9c84436119a83dd516bc99fb0b179d2d83813330dbccff03c5507f644 |
|
MD5 | 662b0b1497ff9852004d42a05eac8929 |
|
BLAKE2b-256 | b58d18dde5f9d95b9413083d7daa3fc0a5eb0bccf1ad18b56b4f9e0e9db0fc78 |
File details
Details for the file lange-0.2101.13-py3-none-any.whl
.
File metadata
- Download URL: lange-0.2101.13-py3-none-any.whl
- Upload date:
- Size: 19.2 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bc627418e870566c8664753190764743bcbaa8f8743b7ddbfe435c493d59067 |
|
MD5 | 701f6ff8ee8f76a427702097a0113ded |
|
BLAKE2b-256 | ed58acf212447c751d8a9694cce733c06e426510891239bd01780ff01e6de88f |