On 2016-06-02 17:17, William Stein wrote:
have an explicit method (e.g., .multiplicative_inverse())?
That's bad for several reasons:

1. Python types won't support it. This new operator is meant to increase compatibility between Sage and Python. I think it's very unlikely that Python types will get a multiplicative_inverse() method.

2. x.multiplicative_inverse() is incredibly verbose for such a basic operation.

3. Method lookup is much slower than an operator.

So I think this is out of the question.


surely we can just make 1/ efficient

This makes more sense. It is also an argument which is likely to come up if we would propose this to Python upstream.

Implementation wise, we could special-case 1/x in the coercion model division and call a c(p)def method x.multiplicative_inverse(). It will be slower than having a dedicated operator but not so bad.

Still, it would be cool to have an operator for the reciprocal.

Jeroen.

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

Reply via email to