Re: How can I make a dictionary that marks itself when it's modified?

2006-01-13 Thread Duncan Booth
Bengt Richter wrote: You are right, but OTOH the OP speaks of a flagging the dict as modified. If she made e.g., modified a property of the dict subclass, then retrieving the the modified flag could dynamically check current state repr vs some prior state repr. Then the question becomes

Re: How can I make a dictionary that marks itself when it's modified?

2006-01-13 Thread Christian Tismer
Just to add a word that I forgot: Adhering to the subject line, the intent is to track modifications of a dict. By definition, modification of a member of a dict without replacing the value is not considered a dict change. I'd stick with the shallow approach. Asking to track mutation of an

Re: How can I make a dictionary that marks itself when it's modified?

2006-01-13 Thread Christian Tismer
Steve Holden wrote: Christian Tismer wrote: Just to add a word that I forgot: Adhering to the subject line, the intent is to track modifications of a dict. By definition, modification of a member of a dict without replacing the value is not considered a dict change. Well, I agree. But I

Re: How can I make a dictionary that marks itself when it's modified?

2006-01-13 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Thanks to everyone who posted comments or put some thought into this problem. I should have been more specific with what I want to do, from your comments the general case of this problem, while I hate to say impossible, is way more trouble than it's worth. By

How can I make a dictionary that marks itself when it's modified?

2006-01-12 Thread sandravandale
It's important that I can read the contents of the dict without flagging it as modified, but I want it to set the flag the moment I add a new element or alter an existing one (the values in the dict are mutable), this is what makes it difficult. Because the values are mutable I don't think you can

Re: How can I make a dictionary that marks itself when it's modified?

2006-01-12 Thread garabik-news-2005-05
[EMAIL PROTECTED] wrote: It's important that I can read the contents of the dict without flagging it as modified, but I want it to set the flag the moment I add a new element or alter an existing one (the values in the dict are mutable), this is what makes it difficult. Because the values are

Re: How can I make a dictionary that marks itself when it's modified?

2006-01-12 Thread Steve Holden
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: It's important that I can read the contents of the dict without flagging it as modified, but I want it to set the flag the moment I add a new element or alter an existing one (the values in the dict are mutable), this is what makes it difficult.

Re: How can I make a dictionary that marks itself when it's modified?

2006-01-12 Thread Bengt Richter
On Thu, 12 Jan 2006 18:28:54 +, Steve Holden [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: It's important that I can read the contents of the dict without flagging it as modified, but I want it to set the flag the moment I add a new element or alter an existing

Re: How can I make a dictionary that marks itself when it's modified?

2006-01-12 Thread Christian Tismer
Steve Holden wrote: [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: It's important that I can read the contents of the dict without flagging it as modified, but I want it to set the flag the moment I add a new element or alter an existing one (the values in the dict are mutable), this is

Re: How can I make a dictionary that marks itself when it's modified?

2006-01-12 Thread Michael Spencer
[EMAIL PROTECTED] wrote: It's important that I can read the contents of the dict without flagging it as modified, but I want it to set the flag the moment I add a new element or alter an existing one (the values in the dict are mutable), this is what makes it difficult. Because the values are

Re: How can I make a dictionary that marks itself when it's modified?

2006-01-12 Thread Steve Holden
Christian Tismer wrote: Just to add a word that I forgot: Adhering to the subject line, the intent is to track modifications of a dict. By definition, modification of a member of a dict without replacing the value is not considered a dict change. Well, I agree. But I suppose much depends

Re: How can I make a dictionary that marks itself when it's modified?

2006-01-12 Thread sandravandale
Thanks to everyone who posted comments or put some thought into this problem. I should have been more specific with what I want to do, from your comments the general case of this problem, while I hate to say impossible, is way more trouble than it's worth. By modified I meant that the dictionary

Re: How can I make a dictionary that marks itself when it's modified?

2006-01-12 Thread Raymond Hettinger
[EMAIL PROTECTED] It's important that I can read the contents of the dict without flagging it as modified, but I want it to set the flag the moment I add a new element or alter an existing one (the values in the dict are mutable), this is what makes it difficult. Because the values are