2014-12-04 10:22 UTC+01:00, Jeroen Demeyer <jdeme...@cage.ugent.be>: > On 2014-12-04 10:04, Vincent Delecroix wrote: >> All right, but in that case I would prefer that there is no __abs__ at >> all. What about deprecating its usage and later on return a ValueError? > Surely not a ValueError! I could live with any of ArithmeticError, > AttributeError, NotImplementedError and TypeError (in decreasing order > of preference).
1) From, Python2 doc exception ArithmeticError: The base class for those built-in exceptions that are raised for various arithmetic errors: OverflowError, ZeroDivisionError, FloatingPointError. It is not exactly what we want... the error message would be "absolute value not defined for matrices". 2) I found the NotImplementedError too ambiguous as it can be interpreted as "this is not done but it should be". from Python2 doc again exception NotImplementedError: This exception is derived from RuntimeError. In user defined base classes, abstract methods should raise this exception when they require derived classes to override the method. So I would be more in favor of an AttributeError (raised with a custom message that tells the user the existence of .norm(1) or .elementwise(abs)). Vincent -- 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.