On Friday, May 16, 2014 2:02:41 PM UTC-7, Nils Bruin wrote:
>
> sage: sage_getsource(hyperbolic_triangle) in 
> open(sage_getfile(hyperbolic_triangle),'r').read()
> False
>

This is now  http://trac.sagemath.org/ticket/16363 with a preliminary 
solution.

In the process of writing that,  I ran into this:

sage/structure/dynamic_class.py line 388:

    if "_sage_src_lines_" not in methods:
        from sage.misc.sageinspect import sage_getsourcelines
        @staticmethod
        def _sage_src_lines():
            return sage_getsourcelines(doccls)
        methods['_sage_src_lines_'] = _sage_src_lines

which doesn't lead to a static method at all:

sage: P.<x,y> = QQ[]
sage: P._sage_src_lines_()
TypeError: _sage_src_lines() takes no arguments (1 given)

Whether a callable attribute on a class binds to an instance is a very 
delicate business in python and apparently the dynamical class voodoo ruins 
it.

Furthermore, if one fixes the code above by letting _sage_src_lines accept 
a (optional) self argument, one sees that the wrong source is returned. 
(Simon introduced code on http://trac.sagemath.org/ticket/11768 to find the 
proper source while relying on the TypeError above. Perhaps the proper code 
should be introduced into _sage_src_lines instead).

-- 
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.

Reply via email to