#12719: Upgrade to IPython 0.13
----------------------------------------------------------+-----------------
       Reporter:  kini                                    |         Owner:  tbd 
                                  
           Type:  enhancement                             |        Status:  
needs_review                          
       Priority:  critical                                |     Milestone:  
sage-5.4                              
      Component:  packages                                |    Resolution:      
                                  
       Keywords:  sd40.5                                  |   Work issues:  
Cython method printing                
Report Upstream:  N/A                                     |     Reviewers:  
Volker Braun, Mike Hansen, Jason Grout
        Authors:  Mike Hansen, Volker Braun, Jason Grout  |     Merged in:      
                                  
   Dependencies:  #13459                                  |      Stopgaps:      
                                  
----------------------------------------------------------+-----------------

Comment (by jhpalmieri):

 Asking the Cython developers is a great idea. Here's a real hack, but it
 seems to work: for built-in functions, if the print representation
 includes "sage.", we use that. (Now that I look at your post to the
 IPython list, it's just a version of the hack you described there.) This
 is a patch for IPython/lib/pretty.py:
 {{{
 #!diff
 --- pretty.py.orig      2012-10-20 17:30:54.000000000 -0700
 +++ pretty.py   2012-10-24 14:19:40.000000000 -0700
 @@ -616,11 +616,14 @@

  def _function_pprint(obj, p, cycle):
      """Base pprint for all functions and builtin functions."""
 -    if obj.__module__ in ('__builtin__', 'exceptions') or not
 obj.__module__:
 -        name = obj.__name__
 +    if obj.__repr__().find('sage.') != -1:
 +        p.text(obj.__repr__())
      else:
 -        name = obj.__module__ + '.' + obj.__name__
 -    p.text('<function %s>' % name)
 +        if obj.__module__ in ('__builtin__', 'exceptions') or not
 obj.__module__:
 +            name = obj.__name__
 +        else:
 +            name = obj.__module__ + '.' + obj.__name__
 +        p.text('<function %s>' % name)


  def _exception_pprint(obj, p, cycle):
 }}}

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