How to identify which numbers in a list are within each others' range

Paul Rubin http
Fri Feb 1 01:11:19 CET 2008


"attn.steven.kuo at gmail.com" <attn.steven.kuo at gmail.com> writes:
> True...  Any lighter-weight implementation of
> sets out there?  That is, one that would defer
> use of resources until actually needed --
> somewhat akin to the distinction between
> range and xrange, and so on.

Don't even think of doing it that way, that solves the space problem
but leaves a speed problem.  You probably want to use something like
sort the intervals and then use the bisect module to find the
intervals intersecting a given one.



More information about the Python-list mailing list