>> here's one attempt. (I'm no expert, so wait for better :-) >> >>> class ModFlagDict(dict): >> def __init__(self, *args, **kwargs): >> super(ModFlagDict, self).__init__(*args, **kwargs) >> self.modified = False >> def __setitem__(self, key, value): >> self.modified = True >> super(ModFlagDict, self).__setitem__(key, value)
You also need to catch __delitem__. You may need to catch pop, update, clear and setdefault, depending on whether or not they call the __setitem__/__delitem__. Personally, I'd catch them all and make sure the flag got set appropriately, because whether or not they use those methods is an implementation detail that may change in the future. <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list