Hacker News new | ask | show | jobs
by tonyg 502 days ago
Python remembers order, and exposes it in its iterations, but doesn't use it in its equivalence over dictionaries (== semantics).

(ETA: What are you quoting there? I don't think that text appears on the Preserves site) (ETA2: Ah, it's the tutorial. Cool)

2 comments

Not sure about the previous post, but also python’s OrderedDict collection guarantees order-sensitive equality checks. [1]

Plain dict maintains insertion order but equality checks only check that the key/value pairs are the same. [2] [3]

[1] https://docs.python.org/3/library/collections.html#:~:text=e...

[2] https://docs.python.org/3/library/stdtypes.html#:~:text=dict...

[3] https://docs.python.org/3/library/stdtypes.html#:~:text=dict...

Yea. Just pointing out that the order can be significant, so throwing it away isn't generally a good idea.