[Zope-CVS] CVS: Packages/pypes/pypes - extent.py:1.9

Casey Duncan casey at zope.com
Wed Apr 21 01:27:56 EDT 2004


Update of /cvs-repository/Packages/pypes/pypes
In directory cvs.zope.org:/tmp/cvs-serv11565

Modified Files:
	extent.py 
Log Message:
Add sameTypeAs() method to check if extents can be combined and compared efficiently


=== Packages/pypes/pypes/extent.py 1.8 => 1.9 ===
--- Packages/pypes/pypes/extent.py:1.8	Sun Mar  7 05:09:12 2004
+++ Packages/pypes/pypes/extent.py	Wed Apr 21 01:27:25 2004
@@ -94,7 +94,7 @@
     
     def union(self, other):
         if isinstance(other, Extent):
-            if self._instances is other._instances:        
+            if self.sameTypeAs(other):  
                 extent = self.__class__(
                     union(self._qualifiers, other._qualifiers), 
                     self._instances)
@@ -109,7 +109,7 @@
     
     def difference(self, other):
         if isinstance(other, Extent):
-            if self._instances is other._instances:        
+            if self.sameTypeAs(other):        
                 extent = self.__class__(
                     difference(self._qualifiers, other._qualifiers), 
                     self._instances)
@@ -124,7 +124,7 @@
     
     def intersection(self, other):
         if isinstance(other, Extent):
-            if self._instances is other._instances:
+            if self.sameTypeAs(other): 
                 extent = self.__class__(
                     intersection(self._qualifiers, other._qualifiers), 
                     self._instances)
@@ -145,20 +145,23 @@
         return extent
     
     def issubset(self, other):
-        if isinstance(other, Extent) and self._instances is other._instances:
+        if isinstance(other, Extent) and self.sameTypeAs(other):
             return not difference(self._qualifiers, other._qualifiers)
         else:
             return self.identitySet().issubset(other)
     
     def issuperset(self, other):
-        if isinstance(other, Extent) and self._instances is other._instances:
+        if isinstance(other, Extent) and self.sameTypeAs(other): 
             return not difference(other._qualifiers, self._qualifiers)
         else:
             return self.identitySet().issuperset(other)
     
+    def sameTypeAs(self, other):
+        return self._instances is other._instances
+    
     def __eq__(self, other):
         if isinstance(other, Extent):
-            if self._instances is other._instances:
+            if self.sameTypeAs(other):
                 return not (difference(self._qualifiers, other._qualifiers) or
                             difference(other._qualifiers, self._qualifiers))
             else:




More information about the Zope-CVS mailing list