[sage-devel] Re: Rich comparison for Elements

2009-06-23 Thread Martin Raum
On 22 Jun., 11:25, Franco Saliola wrote: > Hello, > > Here is a quick description of what is below: Subclasses of Element > complain that no sorting algorithm is defined even when all the rich > comparison methods have been implemented. Bug? > > In the code sample below, C is a class that inher

[sage-devel] Re: Rich comparison for Elements

2009-06-22 Thread Robert Bradshaw
On Jun 22, 2009, at 2:25 AM, Franco Saliola wrote: > > Hello, > > Here is a quick description of what is below: Subclasses of Element > complain that no sorting algorithm is defined even when all the rich > comparison methods have been implemented. Bug? > > In the code sample below, C is a class

[sage-devel] Re: Rich comparison for Elements

2009-06-22 Thread Franco Saliola
On Tue, Jun 23, 2009 at 12:25 AM, Ondrej Certik wrote: > > On Mon, Jun 22, 2009 at 3:25 AM, Franco Saliola wrote: >> >> Hello, >> >> Here is a quick description of what is below: Subclasses of Element >> complain that no sorting algorithm is defined even when all the rich >> comparison methods hav

[sage-devel] Re: Rich comparison for Elements

2009-06-22 Thread Ondrej Certik
On Mon, Jun 22, 2009 at 3:25 AM, Franco Saliola wrote: > > Hello, > > Here is a quick description of what is below: Subclasses of Element > complain that no sorting algorithm is defined even when all the rich > comparison methods have been implemented. Bug? If it helps, I create this page, that l

[sage-devel] Re: Rich comparison for Elements

2009-06-22 Thread Nicolas M. Thiery
On Mon, Jun 22, 2009 at 11:25:32AM +0200, Franco Saliola wrote: > Here is a quick description of what is below: Subclasses of Element > complain that no sorting algorithm is defined even when all the rich > comparison methods have been implemented. Bug? > > In the code sample below, C is a class

[sage-devel] Re: rich comparison

2007-10-26 Thread Robert Bradshaw
If your class has a total order, just override __cmp__. To define partial orders, one needs to override _eq_, etc. separately for python classes, and richcmp for Cython classes. - Robert On Oct 26, 2007, at 3:04 PM, didier deshommes wrote: > 2007/10/26, Robert Miller <[EMAIL PROTECTED]>: >

[sage-devel] Re: rich comparison

2007-10-26 Thread didier deshommes
2007/10/26, Robert Miller <[EMAIL PROTECTED]>: > I have some questions about Python comparison. Suppose I have a Python > class representing objects under some ordering, and I want to > implement <=, <, >=, >, ==, != comparisons on those objects. I > remember hearing somewhere that the __cmp__ met