[Python-checkins] python/dist/src/Lib weakref.py,1.18,1.19
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Sat, 08 Mar 2003 23:05:17 -0800
- Previous message: [Python-checkins] python/dist/src/Lib urllib.py,1.154,1.155
- Next message: [Python-checkins] python/dist/src/Lib/test test_os.py,1.13,1.14 test_shelve.py,1.2,1.3 test_userdict.py,1.13,1.14 test_weakref.py,1.21,1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv14516/Lib
Modified Files:
weakref.py
Log Message:
SF patch #667730: More DictMixin
* Adds missing pop() methods to weakref.py
* Expands test suite to broaden coverage of objects with
a mapping interface.
Contributed by Sebastien Keim.
Index: weakref.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** weakref.py 16 Jul 2002 21:35:23 -0000 1.18
--- weakref.py 9 Mar 2003 07:05:13 -0000 1.19
***************
*** 102,105 ****
--- 102,117 ----
return key, o
+ def pop(self, key, *args):
+ try:
+ o = self.data.pop(key)()
+ except KeyError:
+ if args:
+ return args[0]
+ raise
+ if o is None:
+ raise KeyError, key
+ else:
+ return o
+
def setdefault(self, key, default):
try:
***************
*** 225,228 ****
--- 237,243 ----
if o is not None:
return o, value
+
+ def pop(self, key, *args):
+ return self.data.pop(ref(key), *args)
def setdefault(self, key, default):
- Previous message: [Python-checkins] python/dist/src/Lib urllib.py,1.154,1.155
- Next message: [Python-checkins] python/dist/src/Lib/test test_os.py,1.13,1.14 test_shelve.py,1.2,1.3 test_userdict.py,1.13,1.14 test_weakref.py,1.21,1.22
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]