#16707: Provide more useful error messages from categories
--------------------------+----------------------------
   Reporter:  ppurka      |            Owner:
       Type:  defect      |           Status:  new
   Priority:  major       |        Milestone:  sage-6.3
  Component:  categories  |         Keywords:
  Merged in:              |          Authors:
  Reviewers:              |  Report Upstream:  N/A
Work issues:              |           Branch:
     Commit:              |     Dependencies:
   Stopgaps:              |
--------------------------+----------------------------
 The reason for opening this ticket is well discussed in #16644 (see
 @vbraun's comments). Essentially, things like this should not happen.

 Here is a file called `a.sage`.
 {{{#!python
 import sage.modules.module as module

 class MyClass(module.Module):
     def __init__(self, number):
         base_ring = number.parent()
         module.Module.__init__(self, base_ring)
 }}}
 And here is an output. This should not happen at all.
 {{{
 sage: %runfile a.sage
 sage: C = MyClass(1)
 sage: C.element_class()
 ---------------------------------------------------------------------------
 AttributeError                            Traceback (most recent call
 last)
 <ipython-input-3-66b2e3babdf7> in <module>()
 ----> 1 C.element_class()

 /home/punarbasu/tmp/sage/local/lib/python2.7/site-
 packages/sage/structure/parent.so in
 sage.structure.parent.Parent.__getattr__
 (build/cythonized/sage/structure/parent.c:7290)()

 /home/punarbasu/tmp/sage/local/lib/python2.7/site-
 packages/sage/structure/misc.so in
 sage.structure.misc.getattr_from_other_class
 (build/cythonized/sage/structure/misc.c:1687)()

 AttributeError: 'MyClass_with_category' object has no attribute
 'element_class'

 sage: 'element_class' in dir(C)
 True
 sage: hasattr(C, 'element_class')
 False
 }}}
 There are other cases where it is not clear why some stuff is not
 implemented and yet available in the method list:
 {{{
 sage: C.sum(())
 ---------------------------------------------------------------------------
 NotImplementedError                       Traceback (most recent call
 last)
 ...
 NotImplementedError:
 }}}

 So, this ticket should go through all the default methods that are usually
 available and provide useful error message - for instance the `sum` method
 can say that the `zero()` method needs to be implemented.

 If the changes are extensive, then open other child tickets and put them
 in the "dependencies" of this one.

--
Ticket URL: <http://trac.sagemath.org/ticket/16707>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to