diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-10-29 22:25:45 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-10-29 22:25:45 (GMT) |
commit | a427a2b8d09a756119d424efac85159a0270b503 (patch) | |
tree | f94a983fe68890ca1b91d7dedefaebcd81284597 /Lib/test/test_descrtut.py | |
parent | 7ad2d1eb8eaf8db634b440ef3c4f5a1b9b654cb5 (diff) | |
download | cpython-a427a2b8d09a756119d424efac85159a0270b503.zip cpython-a427a2b8d09a756119d424efac85159a0270b503.tar.gz cpython-a427a2b8d09a756119d424efac85159a0270b503.tar.bz2 |
Rename "dictionary" (type and constructor) to "dict".
Diffstat (limited to 'Lib/test/test_descrtut.py')
-rw-r--r-- | Lib/test/test_descrtut.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py index 2e019aa..eb44200 100644 --- a/Lib/test/test_descrtut.py +++ b/Lib/test/test_descrtut.py @@ -11,21 +11,21 @@ from test_support import sortdict import pprint -class defaultdict(dictionary): +class defaultdict(dict): def __init__(self, default=None): - dictionary.__init__(self) + dict.__init__(self) self.default = default def __getitem__(self, key): try: - return dictionary.__getitem__(self, key) + return dict.__getitem__(self, key) except KeyError: return self.default def get(self, key, *args): if not args: args = (self.default,) - return dictionary.get(self, key, *args) + return dict.get(self, key, *args) def merge(self, other): for key in other: @@ -56,7 +56,7 @@ Here's the new type at work: 3.25 >>> print a[0] # a non-existant item 0.0 - >>> a.merge({1:100, 2:200}) # use a dictionary method + >>> a.merge({1:100, 2:200}) # use a dict method >>> print sortdict(a) # show the result {1: 3.25, 2: 200} >>> @@ -111,23 +111,23 @@ just like classic classes: >>> """ -class defaultdict2(dictionary): +class defaultdict2(dict): __slots__ = ['default'] def __init__(self, default=None): - dictionary.__init__(self) + dict.__init__(self) self.default = default def __getitem__(self, key): try: - return dictionary.__getitem__(self, key) + return dict.__getitem__(self, key) except KeyError: return self.default def get(self, key, *args): if not args: args = (self.default,) - return dictionary.get(self, key, *args) + return dict.get(self, key, *args) def merge(self, other): for key in other: @@ -168,7 +168,7 @@ For instance of built-in types, x.__class__ is now the same as type(x): <type 'list'> >>> isinstance([], list) 1 - >>> isinstance([], dictionary) + >>> isinstance([], dict) 0 >>> isinstance([], object) 1 |