Logo Search packages:      
Sourcecode: relational version File versions  Download package

def relational::relation::relation::__eq__ (   self,
  other 
)
Returns true if the relations are the same, ignoring order of items.
This operation is rather heavy, since it requires sorting and comparing.

Definition at line 373 of file relation.py.

                          :
        '''Returns true if the relations are the same, ignoring order of items.
        This operation is rather heavy, since it requires sorting and comparing.'''
        other=self.rearrange(other) #Rearranges attributes' order so can compare tuples directly
        if (self.__class__!=other.__class__)or(self.header!=other.header):
            return False #Both parameters must be a relation
        
        #Comparing header
        if len(self.header.attributes) != len(other.header.attributes):
            return False #Not the same number of attributes -> not equals
        for i in self.header.attributes:
            if i not in other.header.attributes:
                return False #Non shared attribute
        
        #comparing content
        if len(self.content) != len(other.content):
            return False #Not the same 
        for i in self.content:
            if i not in other.content:
                return False
        return True
        

Generated by  Doxygen 1.6.0   Back to index