On 2022-08-02 at 07:50:52 +1000, Chris Angelico <ros...@gmail.com> wrote:
> On Tue, 2 Aug 2022 at 07:48, <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > On 2022-08-01 at 13:41:11 -0700, > > Dan Stromberg <drsali...@gmail.com> wrote: > > > > > keys = [5, 10, 15, 14, 9, 4, 1, 2, 8, 6, 7, 12, 11] > > > > > > dict_ = {} > > > for key in keys: > > > dict_[key] = 1 > > > > $ python > > Python 3.10.5 (main, Jun 6 2022, 18:49:26) [GCC 12.1.0] on linux > > Type "help", "copyright", "credits" or "license" for more information. > > >>> [hash(x) for x in range(20)] > > [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] > > > > Just sayin'. :-) > > Yes, but I'm pretty sure that's been true for a LONG time. The hashes > for small integers have been themselves for as long as I can remember. > But the behaviour of the dictionary, when fed such keys, is what's > changed. I'm not disputing either of those facts. I'm pointing out that the apparently arbitrary order of a mapping's keys becomes obvious when you look at the hashes of those keys. -- https://mail.python.org/mailman/listinfo/python-list