Re: [sage-devel] How to deal with unsorted output of dictionaries in doctests

2020-02-01 Thread Markus Wageringel
I have opened https://trac.sagemath.org/ticket/29136 proposing to change the default text display preference to "plain" for the text-based backends. > Am 30.01.2020 um 22:17 schrieb Nils Bruin : > > I do not think that's an issue at all. Presently, on t

Re: [sage-devel] How to deal with unsorted output of dictionaries in doctests

2020-01-30 Thread Markus Wageringel
> Am 30.01.2020 um 23:10 schrieb Michael Orlitzky : > > This is a good point, but it's a problem we already have. We don't make > any promises about the precise message contained in e.g. a ValueError, > but we still frequently test the contents. You just update it when you > change the message.

Re: [sage-devel] How to deal with unsorted output of dictionaries in doctests

2020-01-30 Thread Markus Wageringel
Rather than distinguishing the different backends, I was more worried about how to keep what related doctests currently give us. For example, in src/doc/fr/tutorial/latex.rst, pretty_print is advertised as a way to obtain nicely formatted MathJax output: sage: pretty_print(x^12) \newcom

Re: [sage-devel] How to deal with unsorted output of dictionaries in doctests

2020-01-30 Thread Michael Orlitzky
On 1/30/20 3:52 PM, Markus Wageringel wrote: > > While the order of dictionaries is insertion order now, functions in > Sage or in libraries that return dictionaries usually do not make any > promise about the order in which elements are inserted into the > dictionary. Thus, when doctesting such a

Re: [sage-devel] How to deal with unsorted output of dictionaries in doctests

2020-01-30 Thread Nils Bruin
On Thursday, January 30, 2020 at 1:17:14 PM UTC-8, Nils Bruin wrote: > > prints as 'The Sage display manager using the IPython command line > backend' and 'The Sage display manager using the IPython notebook backend' > respectively, so they're already distinguishable. Setting different > default

Re: [sage-devel] How to deal with unsorted output of dictionaries in doctests

2020-01-30 Thread Nils Bruin
On Thursday, January 30, 2020 at 12:52:06 PM UTC-8, Markus Wageringel wrote: > > From the different options mentioned here, my preferred choices are > > 2c) `pretty_print(D, sort=True)` for clarity, or > > 2d) `dict(sorted(D.items()))` for simplicity, as this makes use of > well-known functions an

Re: [sage-devel] How to deal with unsorted output of dictionaries in doctests

2020-01-30 Thread Markus Wageringel
Am Dienstag, 28. Januar 2020 00:41:55 UTC+1 schrieb Michael Orlitzky: > > 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.htm

Re: [sage-devel] How to deal with unsorted output of dictionaries in doctests

2020-01-27 Thread Nils Bruin
On Monday, January 27, 2020 at 4:51:28 PM UTC-8, David Roe wrote: > > > What about having another special doctest comment like "# sort-keys" that > makes the doctest framework sort the keys before printing? This could be > then implemented in one of the above ways in the doctest code. > David >

Re: [sage-devel] How to deal with unsorted output of dictionaries in doctests

2020-01-27 Thread David Roe
On Mon, Jan 27, 2020 at 5:01 PM Nils Bruin wrote: > For 2) there are different possibilities. > a) Something like sorted(D.iteritems()) works, but it means the doctest > now displays a list of tuples rather than something that looks like a dict: > not a problem for "TESTS:" but less than desirab

Re: [sage-devel] How to deal with unsorted output of dictionaries in doctests

2020-01-27 Thread Michael Orlitzky
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 foll

[sage-devel] How to deal with unsorted output of dictionaries in doctests

2020-01-27 Thread Nils Bruin
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 or