On Fri, Dec 10, 2010 at 1:18 PM, Simon King <simon.k...@uni-jena.de> wrote:
> Hi Robert,
>
> On 10 Dez., 19:51, Robert Bradshaw <rober...@math.washington.edu>
> wrote:
>> As for the more general question, the current state of comparison of
>> elements in Sage is a huge mess, and not much should be read into the
>> current structure. It was written before cpdef existed and before the
>> interaction between __cmp__, __richcmp__ and __hash__ was fully
>> understood, and then more hacked on rather than fixed with every
>> iteration of the coercion model. It really just needs to be fixed for
>> once and for all (e.g. make a system where elements define a cpdef
>> _cmp_ and _hash_,
>
> ... and _richcmp_, if one wants cmp(.,.) to behave different
> from .==., right?

Yes, and our _cmp_ and _richcmp_ would coerce for you, like all the
other binary operations. Wow, this is motivating me to finally do
something about it...

> In particular, it would be nice if the methods to be implemented were
> the same for Python and for Cython classes.

Yes, for sure, hence cpdef.

>> with a default __cmp__, __righcmp__, and __hash__
>> provided, and anything needing to do something more fancy  (e.g.
>> symbolic elements) define their own __richcmp__ etc. doing coercion
>> themselves (the binop function is simple enough to use here). There
>> was an attempt made as part of the penultimate coercion re-write, but
>> it was too invasive on top of everything else that was changing at the
>> time.
>
> Yeah, I can imagine that it is hard to do such a big change.
>
> Thanks to you and Jason!

Thanks to you for helping push this through to completion! I can't
wait until we can finally delete parent_old and all the associated
ugliness.

- Robert

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to