summaryrefslogtreecommitdiffstats
path: root/Lib/dos-8x3/userdict.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-08-15 00:45:26 (GMT)
committerGuido van Rossum <guido@python.org>1997-08-15 00:45:26 (GMT)
commitff712aa8abde6a1a892ec39bb124cfd4a7cb992a (patch)
treec5cf2853501f0678abb92fb8e91315b3ee0d8a76 /Lib/dos-8x3/userdict.py
parentf84a539d38ffe79a4eb940c4a2071294fa734fe8 (diff)
downloadcpython-ff712aa8abde6a1a892ec39bb124cfd4a7cb992a.zip
cpython-ff712aa8abde6a1a892ec39bb124cfd4a7cb992a.tar.gz
cpython-ff712aa8abde6a1a892ec39bb124cfd4a7cb992a.tar.bz2
The usual.
Diffstat (limited to 'Lib/dos-8x3/userdict.py')
-rwxr-xr-xLib/dos-8x3/userdict.py40
1 files changed, 25 insertions, 15 deletions
diff --git a/Lib/dos-8x3/userdict.py b/Lib/dos-8x3/userdict.py
index f6b2f82..2f4f541 100755
--- a/Lib/dos-8x3/userdict.py
+++ b/Lib/dos-8x3/userdict.py
@@ -1,18 +1,28 @@
# A more or less complete user-defined wrapper around dictionary objects
class UserDict:
- def __init__(self): self.data = {}
- def __repr__(self): return repr(self.data)
- def __cmp__(self, dict):
- if type(dict) == type(self.data):
- return cmp(self.data, dict)
- else:
- return cmp(self.data, dict.data)
- def __len__(self): return len(self.data)
- def __getitem__(self, key): return self.data[key]
- def __setitem__(self, key, item): self.data[key] = item
- def __delitem__(self, key): del self.data[key]
- def keys(self): return self.data.keys()
- def items(self): return self.data.items()
- def values(self): return self.data.values()
- def has_key(self, key): return self.data.has_key(key)
+ def __init__(self): self.data = {}
+ def __repr__(self): return repr(self.data)
+ def __cmp__(self, dict):
+ if type(dict) == type(self.data):
+ return cmp(self.data, dict)
+ else:
+ return cmp(self.data, dict.data)
+ def __len__(self): return len(self.data)
+ def __getitem__(self, key): return self.data[key]
+ def __setitem__(self, key, item): self.data[key] = item
+ def __delitem__(self, key): del self.data[key]
+ def clear(self): return self.data.clear()
+ def copy(self):
+ import copy
+ return copy.copy(self)
+ def keys(self): return self.data.keys()
+ def items(self): return self.data.items()
+ def values(self): return self.data.values()
+ def has_key(self, key): return self.data.has_key(key)
+ def update(self, other):
+ if type(other) is type(self.data):
+ self.data.update(other)
+ else:
+ for k, v in other.items():
+ self.data[k] = v