segmented range which is represented in a list of sorted interleaving range.
Project description
k3rangeset
segmented range which is represented in a list of sorted interleaving range.
k3rangeset is a component of pykit3 project: a python3 toolkit set.
Segmented range which is represented in a list of sorted interleaving range.
A range set can be thought as: [[1, 2], [5, 7]]
.
Install
pip install k3rangeset
Synopsis
import k3rangeset
a = k3rangeset.RangeSet([[1, 5], [10, 20]])
a.has(1) # True
a.has(8) # False
a.add([5, 7]) # [[1, 7], [10, 20]]
inp = [
[0, 1, [['a', 'b', 'ab'],
['b', 'd', 'bd'],
]],
[1, 2, [['a', 'c', 'ac'],
['c', 'd', 'cd'],
]],
]
r = k3rangeset.RangeDict(inp, dimension=2)
print(r.get(0.5, 'a')) # 'ab'
print(r.get(1.5, 'a')) # 'ac'
Author
Zhang Yanpo (张炎泼) drdr.xp@gmail.com
Copyright and License
The MIT License (MIT)
Copyright (c) 2015 Zhang Yanpo (张炎泼) drdr.xp@gmail.com
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
k3rangeset-0.1.0.tar.gz
(7.8 kB
view details)
Built Distribution
File details
Details for the file k3rangeset-0.1.0.tar.gz
.
File metadata
- Download URL: k3rangeset-0.1.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e295a51faeff6e3ee17d8c8188f826f303c1c58c58ee521946c81885bf57c07 |
|
MD5 | a650d77ece44ad858353235edc20dfbb |
|
BLAKE2b-256 | c665c89d4240e7458f18ad2446da057b5a887e4bd16d3854154ee00dbddb40f8 |
File details
Details for the file k3rangeset-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: k3rangeset-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a367dd27081cc869774a68a6289df5d061e09d125dd77785f07405f75a13121a |
|
MD5 | 0e7f30434b3e948dfd45d88a719fb18f |
|
BLAKE2b-256 | 4fbe2fd067fc37905a0df80985e05e2141f754cb1c4314950fa1c45707ad6dcc |