Le 27/11/2014 10:47, Nathann Cohen a écrit :
It seems to me that as a general principle, a method whose name is an
abbreviation of the name of another method should actually be the same
method. Anything else is hugely confusing to a user. Both the
functionalities described are, of course, useful, but giving them such
similar names has a times certainly confused me.
+1
In order to keep the two features, however, what would you think of a
solution with coeffs, coefficients_list and coefficients_dict ? It
does not look very clean, but that is the only way I see to make it
clearer while not removing the abbreviation.
This would require a deprecation for "coefficients", though.
Alternative solution: it is possible to make coeffs an alias to
coefficients, and to give them both the two features.
coeffs(dense=True) == coefficients(dense=True)
coeffs(sparse=True) == coefficients(sparse=True)
This would require to pick a default value for sparse/dense, which
also means that one of the two functions will have to display a
deprecation warning for a while.
While I agree that the current names can be confusing, we have to be
careful not to make something even more confusing. As mentioned earlier
by John, f.coefficients() is "correlated" with f.exponents() and I think
it is a good feature to keep, and similarly I find important to keep the
consistency with multivariate polynomials (for which only the notion of
"nonzero coefficients" make sense).
The difficulty to my mind, and this may have historically lead to the
current situation, is that for the reasons I mentioned I think that
f.coefficients() should return the nonzero coefficients, and on the
other hand it is also important to have a simple way to ask for the list
of all the coefficients. That's why I find the current situation better
than having a argument "sparse/dense=True" to the function. For the
other proposal of Nathann (coeffs, coefficients_list,
coefficients_dict), I do not find it less confusing since I do not know
which one(s) return the nonzero coefficients and which one(s) return the
full list of coefficients!
Of course, proposing the statu quo may be unpopular ;-). Another
solution I can propose is to keep f.coefficients() as it is, make
f.coeffs() an alias of the former, and only keep f.list() for the list
of all the coefficients.
Cheers,
Bruno
--
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.
For more options, visit https://groups.google.com/d/optout.