On Sat, 22 Oct 2011 05:32:44 +0000, Steven D'Aprano wrote: > On Fri, 21 Oct 2011 16:42:16 -0700, SigmundV wrote: > >> On Oct 21, 2:55 am, Yingjie Lan <lany...@yahoo.com> wrote: >>> >>> In simulation, one can use range objects to denote a discrete domain, >>> and domain comparison could be very useful. Not just equality, but >>> also things like if one domain is contained in another. [...] > If you need a data type to store large numeric domains, whether discrete > or continuous, a tree of intervals storing the lower and upper bounds is > probably the right solution.
And purely by coincidence, I came across this today: http://docs.pylandro.com/pylandro-collections-range/0.1/tutorial.html I haven't used the library yet, but it looks impressive. -- Steven -- http://mail.python.org/mailman/listinfo/python-list