diff options
author | Walter Dörwald <walter@livinglogic.de> | 2004-05-27 18:16:25 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2004-05-27 18:16:25 (GMT) |
commit | 80ce6dd5642025f5cdf0ba5556f08df0803f5636 (patch) | |
tree | ee80f3c46ef4a0700feda4443510780f2e5655da /Lib/weakref.py | |
parent | c139909611162e995321c09a32c4e42433e2655e (diff) | |
download | cpython-80ce6dd5642025f5cdf0ba5556f08df0803f5636.zip cpython-80ce6dd5642025f5cdf0ba5556f08df0803f5636.tar.gz cpython-80ce6dd5642025f5cdf0ba5556f08df0803f5636.tar.bz2 |
The default argument in dict.setdefault() defaults to None.
Add this default to weakref.WeakValueDictionary.setdefault()
and weakref.WeakKeyDictionary.setdefault() too.
Diffstat (limited to 'Lib/weakref.py')
-rw-r--r-- | Lib/weakref.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/weakref.py b/Lib/weakref.py index 5c66186..510cd7c 100644 --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -113,7 +113,7 @@ class WeakValueDictionary(UserDict.UserDict): else: return o - def setdefault(self, key, default): + def setdefault(self, key, default=None): try: wr = self.data[key] except KeyError: @@ -241,7 +241,7 @@ class WeakKeyDictionary(UserDict.UserDict): def pop(self, key, *args): return self.data.pop(ref(key), *args) - def setdefault(self, key, default): + def setdefault(self, key, default=None): return self.data.setdefault(ref(key, self._remove),default) def update(self, dict=None, **kwargs): |