diff options
author | Guido van Rossum <guido@python.org> | 1996-07-22 15:23:25 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-07-22 15:23:25 (GMT) |
commit | 5c971677a5433aff7c1150e39bde222c24c26f39 (patch) | |
tree | 64d0b425bebe8c8a74d6ce51bc4a61817ef388f9 /Lib/dos-8x3/userdict.py | |
parent | ad8b3baa919f5ab1201fca0e608905851f24e967 (diff) | |
download | cpython-5c971677a5433aff7c1150e39bde222c24c26f39.zip cpython-5c971677a5433aff7c1150e39bde222c24c26f39.tar.gz cpython-5c971677a5433aff7c1150e39bde222c24c26f39.tar.bz2 |
Fuck. For PC support, this must be in the distribution.
Diffstat (limited to 'Lib/dos-8x3/userdict.py')
-rwxr-xr-x | Lib/dos-8x3/userdict.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/dos-8x3/userdict.py b/Lib/dos-8x3/userdict.py new file mode 100755 index 0000000..f6b2f82 --- /dev/null +++ b/Lib/dos-8x3/userdict.py @@ -0,0 +1,18 @@ +# 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) |