Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

An interval mapping class (See related posts)

A kind of dictionary which allows you to map data intervals to values.
Download 'intervalmap' from this recipe page.
   1  
   2  >>> i = intervalmap()
   3  >>> i[0:5] = '0-5'
   4  >>> i[8:12] = '8-12'
   5  >>> print i[2]
   6  0-5
   7  >>> print i[10]
   8  8-12
   9  >>>

You need to create an account or log in to post comments to this site.


Click here to browse all 5338 code snippets

Related Posts