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

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

An interval mapping class

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  >>>
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS