Skip to main content

Sets of integers like 1,3-7,33

Project description

travisci PyPI Package latest release PyPI Package monthly downloads Supported versions Supported implementations Wheel packaging support Test line coverage Test branch coverage

intspan is a set subclass that conveniently stores sets of integers. Sets can be created from and displayed as integer spans such as 1-3,14,29,92-97 rather than exhaustive member listings. Compare:

intspan('1-3,14,29,92-97')
[1, 2, 3, 14, 29, 92, 93, 94, 95, 96, 97]

While they indicate the same values, the intspan is more compact. Even more important, it better divulges the contiguous nature of parts of the collection. It is easier for humans to quickly determine the “shape” of the collection and ascertain “what’s missing?”

When iterating, pop()-ing an item, or converting to a list, intspan behaves as if it were an ordered–in fact, sorted–collection. A key implication is that, regardless of the order in which items are added, an intspan will always be rendered in the most compact, organized form possible.

The main draw is having a convenient way to specify (possibly discontinuous) ranges–for example, rows to process in a spreadsheet. It can also help you quickly identify or report which items were not successfully processed in a large dataset.

There is also an ordered intspanlist type that helps specify the ordering of a set of elements.

For this and more, see the full details on Read the Docs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

intspan-1.5.0.zip (15.2 kB view hashes)

Uploaded Source

intspan-1.5.0.tar.gz (10.2 kB view hashes)

Uploaded Source

Built Distribution

intspan-1.5.0-py2.py3-none-any.whl (8.5 kB view hashes)

Uploaded Python 2 Python 3

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