3 ms·
It's sometimes nice to be deterministic. I don't often care about a specific order, only that I get the same order every time.
by xen0 10mo ago
It's sometimes nice to be deterministic.
I don't often care about a specific order, only that I get the same order every time.
- no_wizard 10mo agoThinking about this upfront for me, I am actually wondering why this is useful outside of equality comparisons. Granted, I live and work in TypeScript, where I can't `===` two objects but I could see this deterministic behavior making it easier for a language to compare two objects, especially if equality comparison is dependent on a generated hash. The other is guaranteed iteration order, if you are reliant on the index-contents relationship of an iterable, but we're talking about Dicts which are keyed, but extending this idea to List, I see this usefulness in some scenarios. Beyond that, I'm not sure it matters, but I also realize I could simply not have enough imagination at the moment to think of other benefits
- xen0 10mo agoI work on a build system (Bazel), so perhaps I care more than most. But maybe it does all just come down to equality comparisons. Just not always within your own code.
- dontlaugh 10mo agoBeing able to parse something into a dict and then serialise it back to the same thing is a bit easier. Not a huge advantage, though.