#7857: Arithmetic operations in fraction fields
---------------------------+------------------------------------------------
   Reporter:  spancratz    |       Owner:  spancratz     
       Type:  enhancement  |      Status:  needs_review  
   Priority:  major        |   Milestone:  sage-4.3.1    
  Component:  algebra      |    Keywords:  fraction field
Work_issues:               |      Author:  spancratz     
   Upstream:  N/A          |    Reviewer:  John Cremona  
     Merged:               |  
---------------------------+------------------------------------------------
Changes (by spancratz):

  * status:  needs_work => needs_review


Comment:

 Firstly, I wanted to say that the most recent patch file now passes all
 doctests on my machine.

 It is definitely true that a lot of errors are silenced.  But this is done
 in essentially the same way as before, where, whenever ``reduce`` was
 called from ``__init__``, the three kinds of errors (``AttributeError``,
 ``NotImplementedError``, and ``TypeError``) were converted to an
 ``ArithmeticError``, which was then silenced in ``__init__``.  That is,
 the user would only actually see the errors if he called ``reduce``
 directly.

 Of course, I am not entirely sure about this, but I think the behaviour
 might have been intended.  For example, I don't think someone using
 fraction fields of non-Euclidean PIDs or Euclidean domains without a GCD
 implementation should have to wrap all his basic arithmetic calls in ``try
 ... except``.  On the other hand, if someone explicitly calls ``reduce``,
 the exceptions should be raised and the caller ought to deal with them.
 What do you think, Robert?

 About the second point, I had the impression that for rings the method
 ``inverse_of_unit`` was either implemented or not, rather than it being
 implemented only to return a ``NotImplementedError``, which is why I am
 only catching ``AttributeError``s.  However, if this is not the case, then
 I agree with you, ``NotImplementedError``s should be handled in exactly
 the same way as ``AttributeError``s in this place.  Could you please
 comment on this?

 Thanks,

 Sebastian

 Replying to [comment:10 robertwb]:
 > You seem to be catching and silencing a huge number of errors, without
 explanation (though the code before wasn't too good at that either). Also,
 what if inverse_of_unit raises a NotImplementedError, shouldn't it still
 be as reduced as possible?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7857#comment:11>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB
-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" 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/sage-trac?hl=en.


Reply via email to