From: <ef...@us...> - 2009-09-19 02:53:14
|
Revision: 7788 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7788&view=rev Author: efiring Date: 2009-09-19 02:53:06 +0000 (Sat, 19 Sep 2009) Log Message: ----------- Fix bug in maxdict when replacing an existing item Modified Paths: -------------- branches/v0_99_maint/lib/matplotlib/cbook.py Modified: branches/v0_99_maint/lib/matplotlib/cbook.py =================================================================== --- branches/v0_99_maint/lib/matplotlib/cbook.py 2009-09-18 16:18:51 UTC (rev 7787) +++ branches/v0_99_maint/lib/matplotlib/cbook.py 2009-09-19 02:53:06 UTC (rev 7788) @@ -780,11 +780,12 @@ self.maxsize = maxsize self._killkeys = [] def __setitem__(self, k, v): - if len(self)>=self.maxsize: - del self[self._killkeys[0]] - del self._killkeys[0] + if k not in self: + if len(self)>=self.maxsize: + del self[self._killkeys[0]] + del self._killkeys[0] + self._killkeys.append(k) dict.__setitem__(self, k, v) - self._killkeys.append(k) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |