Because somebody outside of lobste.rs asked for an example for 2. and I can’t edit my comment anymore:
Assume the following code:
With Python <3.6 there is basically no guarantee in which order your keyword arguments are printed. If I call foo(a=1, b=2), the program may print ab or ba. On my machine I get the same output for foo(a=1, b=2) and foo(b=2, a=1). This is how it’s worked since whenever.
WIth Python 3.6, the order is guaranteed: foo(a=1, b=2) appears to always print ab and foo(b=2, a=1) always ba. I’m not sure if this was intended.
Does anyone know if a dictionary implemented in a low-level language like Rust/C/C++/D/Go, and using the same compact/ordered structure, would have the same benefits?
It seems likely. Most of the benefits discussed in the pypy blogpost about it don’t have anything to do with Python (GC friendliness is the only one that does, and that would probably also affect Go and D depending on the details of their GC).
Interesting. FWIW, Go intentionally “randomises” map iteration order (this was introduced after people started relying on a stable iteration order).
Which results in people relying on the order being randomized instead.
Users are the worst.
That would be exciting, and there is precedent for this. Timsort was developed for Python, and has found adoption elsewhere. It’s now the default sort for Java 7!
Bugs and all