Comment #16 on issue 2305 by [email protected]: Integer.isqrt and
similar shouldn't be a method
http://code.google.com/p/sympy/issues/detail?id=2305
I wish that discussing changes before they get pushed in were a more
recurring pattern, but I digress...
There are several different cases here:
* For unary mathematical functions like sqrt or factorial, the interface
that everybody expects is sqrt(4), not (4).sqrt(), so that's what we must
use, no matter how we actually implement it.
* Integer gcd isn't defined only for pairs of integers but also for any set
of integers. The syntax m.gcd(n) can't handle that, and suggests wrongly
that gcd is something that m does to n, instead of being something that
depends on both m and n. You also mention dispatching, but note that there
are actually as many gcd functions as there are rings and that more than
one of them can be meaningful for the same object: the integer GCD of 3 X
and 6 X² is 3, their GCD over ZZ[X] is 3 X, and over QQ[x], X. Considering
this, the best thing to do would be to make gcd() an attribute of a ring
object. As long as we don't have rings in the core, I guess we have to use
something like igcd().
* For factor(), the factorisation of an integer is obviously one of its
essential characteristics (meaning that "2*3*7" is a valid answer to "What
is 42?") so it has to be a property or a method. (BTW, according to this
argument, "factors" and "factorization" would be better names than "factor")
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.