On Aug 3, 5:00 pm, Chris Rebert <c...@rebertia.com> wrote: > On Mon, Aug 3, 2009 at 2:47 PM, r<rt8...@gmail.com> wrote: [snip] > > Not sure if something like this already exists, but it would be > > trivial to implement by overriding dict.__setitem__() > > That is, if you don't care about .update() not preserving the > invariant. Otherwise, one will need to look at the UserDict module. > > Cheers, > Chris > --http://blog.rebertia.com
Good catch Chris. However since the OP said this was for testing purposes, i just *assumed* he would be smart enough *not* to call update() on the dict at hand ;-). But sometimes i need to be protected from myself too -- at least thats what my therapist keeps telling me :-) -- http://mail.python.org/mailman/listinfo/python-list