[ZODB-Dev] __cmp__() for PersistentMapping?

Jim Fulton jim@zope.com
Thu, 16 Aug 2001 13:30:27 -0400


Greg Ward wrote:
> 
> Why does PersistentMapping not have a __cmp__() method?  Seems like a
> no-brainer to me.  In fact, here's a simplistic patch against the
> current CVS (cvs.zope.org:/cvs-repository/StandaloneZODB/ZODB -- hope I
> got it right):
> 
> --- PersistentMapping.py        5 Jun 2001 18:49:58 -0000       1.10
> +++ PersistentMapping.py        16 Aug 2001 15:32:52 -0000
> @@ -106,2 +106,5 @@
> 
> +    def __cmp__(self,other):
> +        return cmp(self._container, other._container)
> +
>      def __delitem__(self, key):
> 
> Of course, this assumes that other is also a PersistentMapping.  Hmmm.

Hm indeed, but this is an improvement.

> Any interest in this? 

Sure.

> I could just check it in to Andrew's SourceForge
> ZEO project, but that seems kind of antisocial...

Yes. I just checked this in.

Jim

--
Jim Fulton           mailto:jim@zope.com       Python Powered!        
Technical Director   (888) 344-4332            http://www.python.org  
Zope Corporation     http://www.zope.com       http://www.zope.org