#11768: Get source code for parent/element classes of categories
-----------------------------------------+----------------------------------
       Reporter:  SimonKing              |         Owner:  jason       
           Type:  enhancement            |        Status:  needs_review
       Priority:  major                  |     Milestone:  sage-5.0    
      Component:  misc                   |    Resolution:              
       Keywords:  sources dynamic class  |   Work issues:              
Report Upstream:  N/A                    |     Reviewers:              
        Authors:  Simon King             |     Merged in:              
   Dependencies:                         |      Stopgaps:              
-----------------------------------------+----------------------------------

Comment (by SimonKing):

 Replying to [comment:21 nthiery]:
 > By the way: feel free to steal this little fix which I did take the time
 not push through ...:

 ??

 According to the comments in the patch, it would ''not'' solve the problem
 addressed here:
 {{{
 Now sage_getsourcelines works similarly for old and new style classes:

 sage: sage_getsourcelines(Sets.ParentMethods)
 sage: sage_getsourcelines(Sets.Algebras)

 Still both fail, because inspect.getsourcelines (in fact
 inspect.findsource) fails on nested classes which have been renamed
 with NestedClassMetaclass:
 ...
 }}}
 The point is that both ''do'' work with my patch:
 {{{
 sage: from sage.misc.sageinspect import sage_getsourcelines
 sage: for x in sage_getsourcelines(Sets.Algebras)[0]:
 ....:     print x,
 ....:
     class Algebras(AlgebrasCategory):

         def extra_super_categories(self):
             """
             EXAMPLES::

                 sage: Sets().Algebras(QQ).extra_super_categories()
                 [Category of modules with basis over Rational Field]

                 sage: Sets().Algebras(QQ).super_categories()
                 [Category of modules with basis over Rational Field]

                 sage: Sets().example().algebra(ZZ).categories()
                 [Category of set algebras over Integer Ring,
                  Category of modules with basis over Integer Ring,
                  ...
                  Category of objects]

             """
             from sage.categories.modules_with_basis import
 ModulesWithBasis
             return [ModulesWithBasis(self.base_ring())]
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11768#comment:22>
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