by minhazm · 4y ago · 0 comments
>>> [i for i in {9,40,49}] [40, 9, 49]
I learned this when a unit test that iterated over a set started failing sporadically :P super confusing bug!
This is because the string hash function is randomized on process startup to help prevent DOS attacks: https://stackoverflow.com/q/30585108/1517969
Also, you can make anything iterable in python if you implement __iter__.