def __eq__(self, other): if other is None: # self is never the null value object return False # try type-specific comparison first spec_eq = self._spec_eq(other) if spec_eq is not None: return spec_eq if not isinstance(other, _Value): # not comparing apples to apples return False # fall back to native comparison function return native_bt.value_compare(self._ptr, other._ptr)