Most viewed recipes tagged "interval"http://code.activestate.com/recipes/tags/interval/views/2010-12-23T12:51:27-08:00ActiveState Code RecipesInterval (Python) 2009-06-20T02:56:04-07:00John Reidhttp://code.activestate.com/recipes/users/4023487/http://code.activestate.com/recipes/576816-interval/ <p style="color: grey"> Python recipe 576816 by <a href="/recipes/users/4023487/">John Reid</a> (<a href="/recipes/tags/interval/">interval</a>). </p> <p>A class to represent intervals with some common operations.</p> An interval mapping data structure (Python) 2010-12-23T12:51:27-08:00Matteo Dell'Amicohttp://code.activestate.com/recipes/users/2433284/http://code.activestate.com/recipes/577515-an-interval-mapping-data-structure/ <p style="color: grey"> Python recipe 577515 by <a href="/recipes/users/2433284/">Matteo Dell'Amico</a> (<a href="/recipes/tags/algorithms/">algorithms</a>, <a href="/recipes/tags/interval/">interval</a>, <a href="/recipes/tags/mapping/">mapping</a>). </p> <p>This structure is a kind of dictionary which allows you to map data intervals to values. You can then query the structure for a given point, and it returns the value associated to the interval which contains the point. Boundary values don't need to be an integer.</p> <p>In this version, the excellent <a href="http://pypi.python.org/pypi/blist/">blist</a> library by Daniel Stutzbach is used for efficiency. By using the collections.MutableMapping abstract base class, the whole signature of mappings is supported.</p>