[quote]The idea behind that class is to act "as-if" it were a real  
dictionary.  
Dicts have an update method, and UserDict should too. But  it's not listed  
in the book (should appear a few lines below that  code); this is a  
possible implementation:

def update(self,  other):
for key in other.keys():
self.data[key] = other[key]

Given this method, __init__  works fine.
Using self.data.update(dict) is OK if the dict argument is a  real  
dictionary, but not if it's another UserDict.[/quote]
 
 
Thank you.
But I'm still confused that what's the "real dictionary"?I can't know  this 
point.Please help and thanks  again.


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to