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.

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to