On 1/27/20 5:01 PM, Nils Bruin wrote:
> This came up in https://trac.sagemath.org/ticket/29042 :
> In current IPython, dictionaries are no longer sorted on output, because
> in Py3 there is a slightly more meaningful order to the dict: it's close
> to insertion order. So it seems reasonable to follow this order for
> printing too.
> Yet, the order in not actually intrinsically meaningful for the dict.
> We have previously relied on the sorting of dictionaries to make
> doctests of dictionaries work smoothly. We need to change that if we
> upgrade IPython. There seem to be two main options:
>  1) we adjust the doctests to the new output order of IPython
>  2) we adjust the doctests so that the output order is somehow sorted.
> 
> The problem with 1) is that it's a nasty change (it hits quite a few
> doctests), and it's rather fundamentally fragile: if some code changes
> somewhere (or, unlikely, Py3 changes dict ordering), doctests break again.
> 

The insertion order is part of the language as of python-3.7, and can't
be changed:

* https://mail.python.org/pipermail/python-dev/2017-December/151283.html
* https://docs.python.org/3.7/tutorial/datastructures.html#dictionaries

So while it sucks, I guess we should update all of the doctests to print
in that order. It was always a bad idea to rely on them being sorted,
and I don't think I agree with making the order part of the language,
but that's what we've got.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/da4e4249-068d-af9d-7f3a-813134f50e55%40orlitzky.com.

Reply via email to