Dictionary equality comparison differs from CPython
I'm not sure if this a known difference with CPython, but when comparing dictionaries for equality, the transpiled JS always returns false. I assume this has to do with how JavaScript compares objects in general. For example:
Python Code:
def dict_test():
x = {'a': 12, 'c': 99, 'b': 54}
y = {'a': 12, 'b': 54, 'c': 99}
print(x == y)
# returns True
Transcrypted Code:
export var dict_test = function () {
var x = dict({"a": 12, "c": 99, "b": 54});
var y = dict({"a": 12, "c": 99, "b": 54});
print(x == y)
};
// returns false
I'm assuming the only solution would be to do a recursive comparison of values, or use a 3rd party library like Lodash's _.isEqual() function.
There is no dict comparison code in Transcrypt, I have already reported it in: https://github.com/QQuick/Transcrypt/issues/721
It is not a known difference but an omission. Will classify it as enhancement with #721 Thanks!