But that code still can raise an error XPTY0004. Do you want errors raised? If not, then perhaps before trying to compare two items, see if one is a subtype of the other: if not, interpret that to mean "not equal" and never perform the comparison directly.
But that code still can raise an error XPTY0004. Do you want errors raised? If not, then perhaps before trying to compare two items, see if one is a subtype of the other: if not, interpret that to mean "not equal" and never perform the comparison directly.