> Yep. Since this is such a common case, I wonder if we should modify
> the Sage integer __richcmp__ method to be more sophisticated, and
> allow direct comparisons with builtin Python types, without first
> requiring them to be converted to Sage integers?


That's such a good idea that I did it.
http://trac.sagemath.org/sage_trac/ticket/10314, ready for review.

BEFORE:
sage: a = 3
sage: b = 4r
sage: timeit("a < b")
625 loops, best of 3: 1.34 µs per loop

AFTER:
sage: a = 3
sage: b = 4r
sage: timeit("a < b")
625 loops, best of 3: 147 ns per loop

David

-- 
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