On Tuesday, October 17, 2017 at 9:55:25 AM UTC-5, Simon Brandhorst wrote: > > I got that now. But at the time I thought __richcmp__ was just a fancy new > name for the old __cmp__ in python in order to make it python 3 compatible. > > Anyways. It would be nice to say something like that in the documentation. > (Maybe I have just missed it and it is there already.) > " > @richcmp_method simply allows to define just > one comparison method __richcmp__ instead of six __eq__, __lt__, ... " > " > and add a reference to some working example somewhere in the sage library. > As many people will come across that file who are not programmers and do > not speak cython. > And in future they will also not know about the __cmp__ method of python > 2.7 > > In Python, those are called rich comparisons and returning NotImplemented is a Python thing for rich comparisons, including in things like __eq__. So it doesn't have to do with speaking Cython. IMO, anytime you want to find an example in the Sage library, grep is your friend and is more robust than in some place in the documentation that could (quickly) go out of date. However, I agree with you that the documentation could be improved by stating about returning NotImplemented and having a more complete example.
Best, Travis -- 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 sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.