Iteration Order Reliability

Discussions center on whether the order of elements in data structures like sets, dictionaries, or directories is guaranteed, meaningful, or safe to rely on, and the implications for code that assumes specific ordering.

➡️ Stable 0.6x Programming Languages
3,376
Comments
20
Years Active
5
Top Authors
#8154
Topic ID

Activity Over Time

2007
5
2008
8
2009
45
2010
47
2011
63
2012
72
2013
132
2014
141
2015
123
2016
205
2017
151
2018
211
2019
230
2020
334
2021
301
2022
326
2023
315
2024
317
2025
329
2026
21

Keywords

PriorityItems e.g PriorityItem CSS OP P2 ycombinator.com OK P1 OCD order ordering dictionary sorted ordered dir annotations matters procedure values

Sample Comments

kzrdude Sep 9, 2016 View on HN

They should say "arbitrary order"

LinAGKar Jan 26, 2022 View on HN

That doesn't explain the order

pvg Feb 7, 2017 View on HN

You might have better luck with this on SO but there's no guaranteed order (nor would it make much sense for there to be one)

zhng Jun 14, 2014 View on HN

It should as order is important.

mrwnmonm Jul 16, 2013 View on HN

why did you choose that order, is there a reason for it?

evmar Jun 3, 2021 View on HN

If the order matters, it's only as hard as using a (different) data structure that preserves order.

nl Oct 8, 2020 View on HN

That's not obvious in the order. Do you have somewhere we can read that?

boesboes Apr 20, 2024 View on HN

This seems related: https://news.ycombinator.com/item?id=39672111As in, order matters

impostervt Jan 6, 2015 View on HN

The order doesn't convey any meaning.

randallsquared Jan 4, 2009 View on HN

No, you've reintroduced ordering.