On Feb 19, 9:38 am, Simon King <simon.k...@uni-jena.de> wrote:
> sage: cython("""
> class Bla:
>     def __hash__(self):
>         return 2
>     def __cmp__(self, other):
>         print "cmp"
>         return 0
>     def __richcmp__(self, other, m):
>         print "calling richcmp"
>         if m==2:
>             return self is other
>         if m==3:
>             return self is not other
>         print "neither == nor !="
>         return False
> """)

__richcmp__ is not a special method for python classes. You need to
implement __eq__ etc for those. I'd hope (and this example
corroborates it) that cython decided to use the same semantics for non-
cdef classes. Your example wouldn't change if you called the method
__foo__ instead.

-- 
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 http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to