[sage-devel] Re: sorted is not portable!?!

2010-09-01 Thread Simon King
Hi Mike! On 1 Sep., 19:45, Mike Hansen mhan...@gmail.com wrote: It's always been somewhat machine dependent -- seehttp://yz.mit.edu/wp/default-behavior-of-pythons-cmp/. Ah! So, the problem is that I have both strings and integers, there is no __cmp__ implemented that compares both, and thus

Re: [sage-devel] Re: sorted is not portable!?!

2010-09-01 Thread Mike Hansen
On Wed, Sep 1, 2010 at 11:00 AM, Simon King simon.k...@nuigalway.ie wrote: But then, what can one do? I.e., how can one safely doctest the contents of a dictionary D? You could build the dictionary and check that it is equal to the dictionary in question: sage: L {360: {}, 2520: {0: 'X'},

[sage-devel] Re: sorted is not portable!?!

2010-09-01 Thread Simon King
Hi Mike! On 1 Sep., 20:05, Mike Hansen mhan...@gmail.com wrote: You could build the dictionary and check that it is equal to the dictionary in question: sage: L {360: {}, 2520: {0: 'X'}, 'prime': 3} sage: dict([(360, {}), (2520, {0: 'X'}), ('prime', 3)]) == L True Good idea! Thank you,

[sage-devel] Re: sorted is not portable!?!

2010-09-01 Thread Nils Bruin
On Sep 1, 11:00 am, Simon King simon.k...@nuigalway.ie wrote: But then, what can one do? I.e., how can one safely doctest the contents of a dictionary D? If the default choice of sorted is not portable, make sure to tell the system to sort on something that is portable, like you suggest: At