Re: [sage-devel] Re: sorting output dicts in doctests

2021-02-08 Thread John Cremona
#3 is now under review, so if any one thinks that the tests I put in there need changing they can say so on trac. John On Sun, 7 Feb 2021 at 23:18, 'Travis Scrimshaw' via sage-devel wrote: > > Hi John, >> >> >> Travis, this relates to ticket #3 which I should be uploading code for >> to

Re: [sage-devel] Re: sorting output dicts in doctests

2021-02-07 Thread 'Travis Scrimshaw' via sage-devel
Hi John, > > Travis, this relates to ticket #3 which I should be uploading code for > today, so there is nothing to see there yet. The output to one function > will be a pair, True/False and a dict, so this fits with what you said. > What I will do is assign the two parts to variables and

Re: [sage-devel] Re: sorting output dicts in doctests

2021-02-07 Thread Samuel Lelievre
Another option might be to use an OrderedDict. If I understand correctly, this becomes unnecessary in Python >= 3.7 where dict behaves like OrderedDict. If I understand correctly, Sage 9.3 will still support Python 3.6 but Sage 9.4 probably won't, after - Sage Trac ticket 30551 Drop Python 3.6

Re: [sage-devel] Re: sorting output dicts in doctests

2021-02-05 Thread John Cremona
Thanks for the suggestions (which I did not see right away as I had my group preference set to daily digest -- it's annoying that google does not make ex exception for replies to one's own posts!) Travis, this relates to ticket #3 which I should be uploading code for today, so there is noth

Re: [sage-devel] Re: sorting output dicts in doctests

2021-02-04 Thread 'Reimundo Heluani' via sage-devel
In addition to that I've been using the idiom MyOutput == {this : dict} True And that works for tests and renders well on documents R On February 4, 2021 8:34:36 PM GMT-03:00, 'Travis Scrimshaw' via sage-devel wrote: >Hi John, >IIRC, a dict has its keys automatically sorted in the output. How

[sage-devel] Re: sorting output dicts in doctests

2021-02-04 Thread 'Travis Scrimshaw' via sage-devel
Hi John, IIRC, a dict has its keys automatically sorted in the output. However, if the dict is inside of another object, then no sorting is done. So if it is a simple dict with a total ordering on the keys, then you can simply put the output. You can also run sorted() on the items if they di