I'm surprised that no one has talked about using ord in python (It Returns the Unicode code point for a string) and comparing the sum
>>> sum(map(ord, 'stressed')) == sum(map(ord, 'desserts'))
It even performs better than sorting
>>> timeit.timeit("sorted('stressed') == sorted('desserts')")
>>> timeit.timeit("sum(map(ord, 'stressed')) == sum(map(ord, 'desserts'))")
It performs better but it's wrong. Comparing sums can give you false positives.
>>> sum(map(ord, 'false positive'))
>>> sum(map(ord, 'farce positivo'))
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.