def __eq__(self, other):
        """Compare fields.

        Two fields are equal if they have the same shape and offset.
        """
        return (isinstance(other, Field) and
                Shape.cast(self._shape) == Shape.cast(other.shape) and
                self._offset == other.offset)
Compare fields.

        Two fields are equal if they have the same shape and offset.
        
amaranth/lib/data.py