Hi everyone,
I'm learning about the inner workings of sets and dicts in Fluent Python and the companion site. I have an example where the order being presented to
Here is a basic example taken from Internals of Sets and Dicts. We have a set of strings,
workdays = {'Mon', 'Tue', 'Wed', 'Thu', 'Fri'}
and when you print them, they are rearranged.
workdays Out[24]: {'Fri', 'Mon', 'Thu', 'Tue', 'Wed'}
As explained in the companion site, the way the hash algorithm works is that python goes element-by-element, computes the hash (which we can retrieve with hash()), and then modulos the hash inte