[sage-devel] Re: Suspiciously sorted sets

2009-09-21 Thread Simon King
Hi Nick, On 22 Sep., 00:02, Nick Alexander wrote: > Just for the record, "sorted sets" make very little sense.   Sure. When I said "unless something implements a __cmp__ method..." I did not mean that one *should* implement it; I just wanted to explain "sorted(...) relies on a __cmp__ method, s

[sage-devel] Re: Suspiciously sorted sets

2009-09-21 Thread Nick Alexander
> I'll likely add to Trac a ticket about the need for a comparison > method on sets later today when I get a chance. Just for the record, "sorted sets" make very little sense. It is important to be able to have a set containing anything that is hashable (in the python sense) but not necessar

[sage-devel] Re: Suspiciously sorted sets

2009-09-21 Thread Rob Beezer
Hi Simon, Thanks for the explanation and isolating the problem, plus the workaround for getting a unique result. I did have doctesting in the back of my mind, even though it is not necessary at the moment for the patch in question. I'll likely add to Trac a ticket about the need for a compariso

[sage-devel] Re: Suspiciously sorted sets

2009-09-21 Thread Simon King
Hi! On Sep 21, 10:22 am, Simon King wrote: [...] > So, unless someone implements __cmp__ (or similar) methods for > Set_object_enumerated, you can't expect to get anything meaningful out > of the sorting. If your question is just about getting *some* unique result (say, for a doc test): You can

[sage-devel] Re: Suspiciously sorted sets

2009-09-21 Thread Simon King
Hi Rob! On Sep 21, 2:15 am, Rob Beezer wrote: > sage: g = Graph() > sage: g.add_vertices(Subsets(3,2)) > sage: g.vertices() > [{2, 3}, {1, 2}, {1, 3}] > sage: sorted(g.vertices()) > [{1, 3}, {1, 2}, {2, 3}] > sage: Subsets(3,2).list() > [{1, 2}, {1, 3}, {2, 3}] > sage: sorted(Subsets(3,2).list()