tracking collection modification

usenet.tolomea at gmail.com usenet.tolomea at gmail.com
Mon Sep 8 08:23:11 EDT 2008


On Sep 7, 8:54 pm, usenet.tolo... at gmail.com wrote:
> 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?

additionally I don't need to know if the things the list (etc)
references have changed, only the list itself



More information about the Python-list mailing list