The expression equals operator is using ‘shallow’ quality; under the hood, for various reasons, this is ultimately becoming a simple identity check.
We could potentially make this smarter in the future, but it won’t help you much right now.
In the short term, you can lean on Python a bit; use runScript
to convert Perspective types to equivalent Python representation, then run your equality comparison on those:
def sanitize_tree(element):
if hasattr(element, '__iter__'):
if hasattr(element, 'keys'):
return dict((k, sanitize_tree(element[k])) for k in element.keys())
else:
return list(sanitize_tree(x) for x in element)
return element
def deepEquals(left, right):
return sanitize_tree(left) == sanitize_tree(right)
(see this post for more on the sanitize_tree
function)
Can be used basically the same as your existing:
runScript("utils.deepEquals", 0, {view.custom.left}, {view.custom.right})