[Zodb-checkins] SVN: ZODB/trunk/src/persistent/ - added pop
method to persistent mapping and dict
Tim Peters
tim.peters at gmail.com
Sun Nov 20 19:19:22 EST 2005
[Thomas Lotze]
> Log message for revision 40269:
> - added pop method to persistent mapping and dict
> - added unit tests for persistend mapping
Cool! Here are some problems:
...
> Modified: ZODB/trunk/src/persistent/dict.py
...
> + def pop(self, i):
> + self._p_changed = True
> + return self.__super_pop(i)
This isn't a correct signature for pop(); it should also accept
another optional argument. See the Python docs for pop():
http://docs.python.org/lib/typesmapping.html
> --- ZODB/trunk/src/persistent/mapping.py 2005-11-20 01:03:32 UTC (rev 40268)
...
> try:
> + __super_pop = UserDict.pop
> + except AttributeError:
> + pass
> + else:
> + def pop(self, i):
> + self._p_changed = 1
> + return self.__super_pop(i)
As above, plus there's no need for the try/except business here.
PersistentMapping.py is very old by now, and is still trying to cater
to old Pythons ZODB wouldn't work with anymore anyway. All supported
Pythons have UserDict.pop().
> Copied: ZODB/trunk/src/persistent/tests/test_mapping.py (from rev 40242, ZODB/trunk/src/persistent/tests/test_list.py)
> ...
+##############################################################################
> +#
> +# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
If you're adding a new file, it should have 2005 as the copyright date.
More information about the Zodb-checkins
mailing list