Any way to use a range as a key in a dictionary?

Paul Rubin http
Thu Mar 26 18:13:53 EDT 2009


Mudcat <mnations at gmail.com> writes:
> However I wondered if there was a way to simply use a range as a key
> reference somehow. 

Dictionaries aren't really the right structure for that.  You want a
tree or binary search structure of some sort.  The bisect module might
be helpful, but you will have to write some code by hand if you use
it.



More information about the Python-list mailing list