no.email at please.post
Mon Aug 3 23:07:32 CEST 2009
I use the term "no-clobber dict" to refer to a dictionary D with
the especial property that if K is in D, then
D[K] = V
will raise an exception unless V == D[K]. In other words, D[K]
can be set if K doesn't exist already among D's keys, or if the
assigned value is equal to the current value of D[K]. All other
assignments to D[K] trigger an exception.
The idea here is to detect inconsistencies in the data.
This is a data structure I often need. Before I re-invent the
wheel, I thought I'd ask: is it already available?
More information about the Python-list