cs.range-20190102
توضیحات
a Range class implementing compact integer ranges with a set-like API, and associated functions
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | cs.range-20190102 |
| نام | cs.range |
| نسخه کتابخانه | 20190102 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Cameron Simpson |
| ایمیل نویسنده | cs@cskk.id.au |
| آدرس صفحه اصلی | https://bitbucket.org/cameron_simpson/css/commits/all |
| آدرس اینترنتی | https://pypi.org/project/cs.range/ |
| مجوز | - |
A Range is an object resembling a set but optimised for contiguous
ranges of int members.
## Function `overlap(span1, span2)`
Return a list `[start,end]` denoting the overlap of two spans.
Example:
>>> overlap([1,9], [5,13])
[5, 9]
## Class `Range`
A collection of ints that collates adjacent ints.
The interface is as for a `set` with additional methods:
* `spans()`: return an iterable of `Spans`, with `.start`
included in each `Span` and `.end` just beyond
Additionally, the update/remove/etc methods have a secondary
calling signature: `(start,end)`, which is the same as passing
in `Range(start,end)` but much more efficient.
## Class `Span`
MRO: `Span`, `builtins.tuple`
A namedtuple with `.start` and `.end` attributes.
## Function `spans(items)`
Return an iterable of `Spans` for all contiguous sequences in
`items`.
Example:
>>> list(spans([1,2,3,7,8,11,5]))
[1:4, 7:9, 11:12, 5:6]
نحوه نصب
نصب پکیج whl cs.range-20190102:
pip install cs.range-20190102.whl
نصب پکیج tar.gz cs.range-20190102:
pip install cs.range-20190102.tar.gz