You make a very good point, I'll try to be careful. I doubt this is a case of efficiency since now __call__ goes through redundant cases and even has an argument that is not used anywhere. Anyway I will cobble together something and we can do speed testing before merging.


* Nils Bruin <nbr...@sfu.ca> [2018-11-22 11:10:11]:

Pay attention, though. There may be all kinds of guidelines about how to
write sage code "appropriately", but in classes where performance is very
important there may be shortcuts that violate the guidelines. That may very
well be intentional. It may also be that it's legacy code and that
rewriting it according to the latest trends does not particularly affect
performance negatively.

On Thursday, November 22, 2018 at 9:48:41 AM UTC-8, Salvatore Stella wrote:

After a more accurate inspection, it appears that MPolynomialRing_polydict
is
in quite a bad shape. First of all it redefines __call__ which, if I read
[1]
correctly, should not be done. Second, within the many cases in __call__
one
can find:

{{{
510         elif isinstance(x, dict):
511             K = self.base_ring()
512             return MPolynomial_polydict(self, {i: K(a) for i, a in
iteritems(x)})
}}}

and few lines below

{{{
561         if isinstance(x, dict):
562             return MPolynomial_polydict(self, x)
}}}

Clearly some housekeeping is in order. I'll try to do something about it
and
then post again. Any input is welcome
S.

[1]
http://doc.sagemath.org/html/en/thematic_tutorials/coercion_and_categories.html#coercion-the-basics




* Simon King <simon...@uni-jena.de <javascript:>> [2018-11-22 14:10:14]:

>On 2018-11-22, Simon King <simon...@uni-jena.de <javascript:>> wrote:
>> However, I believe it is bad usage to hard-code a certain class as
>> output of arithmetic errors.
>
>Oops. "errors" is an error, it should be "operations".
>
>--
>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+...@googlegroups.com <javascript:>.
>To post to this group, send email to sage-...@googlegroups.com
<javascript:>.
>Visit this group at https://groups.google.com/group/sage-devel.
>For more options, visit https://groups.google.com/d/optout.


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

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