tracking collection modification

usenet.tolomea at gmail.com usenet.tolomea at gmail.com
Sun Sep 7 06:54:54 EDT 2008


I'm working on a remote object system, something kinda like Pyro.
For the purposes of caching I need to be able to tell if a given
dict / list / set has been modified.
Ideally what I'd like is for them to have a modification count
variable that increments every time the particular collection is
modified. Unfortunately I can't find anything like that and since this
needs to work for the regular normal list / dict / set objects
subclassing them to add the modification count isn't useful.
I realize I could take a copy and then compare the copy to the
original, but that's a fairly heavy handed approach and I was hoping
for something light and fast.
Does anyone have any suggestions on best to approach this?



More information about the Python-list mailing list