Hi Simon,

> Another data point: In your example above, one has
>  sage: 'sum' in dir(R)
>  True
>  sage: R.__dict__['sum']
>  
> ---------------------------------------------------------------------------
>  KeyError                                  Traceback (most recent call
> last)
> 
>  /home/king/<ipython console> in <module>()
> 
>  KeyError: 'sum'
> 
> So, introspection seems to be seriously screwed up.
> 
> R has both a __getattr__ and a __dir__ method that seem to be rather
> generic. Is this part of the combinat/category framework? So, my
> uneducated guess is that R belongs to a category whose objects
> *should* provide a sum method, but nobody has implemented it (though
> "sum" sounds like there could be generic code for it as well).

One remark to support your guess:

sage: R._test_category()
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)

/usr/local/sage/sage-4.4.2/local/lib/python2.6/site-packages/Sphinx-0.6.3-py2.6.egg/sphinx/<ipython
 console> in <module>()

/usr/local/sage/sage/local/lib/python2.6/site-packages/sage/structure/parent.so 
in sage.structure.parent.Parent._test_category (sage/structure/parent.c:4730)()

/usr/local/sage/sage/local/lib/python/unittest.pyc in failUnless(self, expr, 
msg)
    323     def failUnless(self, expr, msg=None):
    324         """Fail the test unless the expression is true."""
--> 325         if not expr: raise self.failureException, msg
    326
    327     def failUnlessRaises(self, excClass, callableObj, *args, **kwargs):

AssertionError: category of self improperly initialized

Cheers,

Florent

-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to