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

Paul Rubin http
Sat Mar 28 19:56:40 CET 2009


Dennis Lee Bieber <wlfraed at ix.netcom.com> writes:
> 	And what real difference is that going to gain versus the existing
> .get() method where the default is a sentinel? 

It's just less ugly.  I don't know a way to get a unique sentinel
other than "sentinel = object()" or something like that, creating more
clutter.  Maybe in a specific application, I can figure out a value
that won't occur in the dictionary and use that, but it's cleaner to
use a generic construction.



More information about the Python-list mailing list