I disagree with the whole idea that doctests should be deliberately fragile 
and break randomly on the buildbot to teach unwary developers a lesson. 
Either sort by keys, or disallow dictionary output altogether AND print a 
useful diagnostic in doctests. 

This whole discussion is similar to the recent ticket #16644 where unwary 
users get an incorrect and misleading error message from the category 
framework. Pushing newbies off a cliff like that does not result in 
interest for how the __getattr__ black magic works, it just steers people 
away from Sage.

Coming back to the dictionary sort order. it is a CPython implementation 
detail that some keys are always sorted (e.g. small positive integers). In 
fact, this is used in a lot of doctests. 



On Thursday, July 31, 2014 5:23:03 PM UTC-4, Travis Scrimshaw wrote:
>
>    I disagree with sorting the output of dicts. I ended up finding a very 
> subtle bug dealing with dictionary output that I would have had a much 
> harder time figuring out with the automatic sorting. Just do 
> ``sorted(d.items(), key=str)`` for doctests where the order could change 
> (which usually is for dicts of size larger than 3).
>
> Best,
> Travis
>
>
> On Thursday, July 31, 2014 9:14:30 AM UTC-7, Volker Braun wrote:
>>
>> This is now http://trac.sagemath.org/ticket/16746
>>
>> On Thursday, July 31, 2014 11:23:14 AM UTC-4, Volker Braun wrote:
>>>
>>> The doctesting uses its own displayhook, though I thought it would also 
>>> sort dicts (since it obviously helps with making doctests reproducable). 
>>> IMHO we should add it...
>>>
>>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to