def __eq__(self, other):
        """Compares two symbol tables together.

        Two symbol tables are considered equal if the underlying tokens are the same and the
        ``table_type``, ``name``, ``version``, and ``is_substitute`` attributes are defined and are equal.

        Note:
            This is implemented using ``getattr`` to allow duck-typed table implementations to compare.
            Any custom symbol table-like implementation should implement this method accordingly.

            Things that are not compared:

             * ``imports`` are never compared as they are denormalized into the tokens of the table.
             * ``max_id`` is never compared as its an invariant that it matches the iteration.
        """
        if self is other:
            return True

        # Compare relevant attributes
        if self.table_type != getattr(other, 'table_type', None):
            return False
        if self.name != getattr(other, 'name', None):
            return False
        if self.version != getattr(other, 'version', None):
            return False
        if self.is_substitute != getattr(other, 'is_substitute', None):
            return False

        # Compare tokens.
        other_iter = getattr(other, '__iter__')
        if not callable(other_iter):
            return False
        for token, other_token in six.moves.zip_longest(self, other):
            if token != other_token:
                return False

        return True
def __eq__ ( self , other ) : if self is other : return True if self . table_type != getattr ( other , 'table_type' , None ) : return False if self . name != getattr ( other , 'name' , None ) : return False if self . version != getattr ( other , 'version' , None ) : return False if self . is_substitute != getattr ( other , 'is_substitute' , None ) : return False other_iter = getattr ( other , '__iter__' ) if not callable ( other_iter ) : return False for token , other_token in six . moves . zip_longest ( self , other ) : if token != other_token : return False return True
Compares two symbol tables together.

        Two symbol tables are considered equal if the underlying tokens are the same and the
        ``table_type``, ``name``, ``version``, and ``is_substitute`` attributes are defined and are equal.

        Note:
            This is implemented using ``getattr`` to allow duck-typed table implementations to compare.
            Any custom symbol table-like implementation should implement this method accordingly.

            Things that are not compared:

             * ``imports`` are never compared as they are denormalized into the tokens of the table.
             * ``max_id`` is never compared as its an invariant that it matches the iteration.