sparse sets of integers?

Terry Reedy tjreedy at udel.edu
Mon Apr 4 19:56:40 EDT 2005


"Dan Stromberg" <strombrg at dcs.nac.uci.edu> wrote in message 
news:pan.2005.04.04.21.52.58.910482 at dcs.nac.uci.edu...
>
> Does anyone have a python implementation (or python C/C+ extension) that
> would allow me to perform set operations (union, intersection, 
> difference,
> number of elements, &c) over very large collections of integers?
>
> Some of the sets may have over 10**11 (probably less than 10**13
> though) integers in them, but there will tend to be runs of integers 
> being
> included or not included, so there might be 10**5 consecutive integers
> included, then 10**4 that are not included, and then another 10**6 that
> are.

I would call this chunky rather than sparse.  Or a set (ordered list) of 
integer ranges, which I am sure is how you implemented it before.  I did 
not find anything Googling 'Python integer range set' but would look harder 
before coding.

Terry J. Reedy






More information about the Python-list mailing list