We can reach inside IPython and put another formatter in place for
"type" and "classobj" objects:

sage: type(1)
sage.rings.integer.Integer
sage: import IPython
sage: self=sys.displayhook.shell.display_formatter.formatters[u'text/
plain']
sage: T=[k for k,v in self.type_printers.items() if v is
IPython.lib.pretty._type_pprint]
sage: T # [<type 'type'>, <type 'classobj'>]
[type, classobj]
sage: self.type_printers[type]=IPython.lib.pretty._repr_pprint
sage: type(1)
<type 'sage.rings.integer.Integer'>

Note that "self" here is a
sage.misc.sage_extension.SagePlainTextFormatter, so we can also solve
this problem ourselves. In fact, its __call__ first tries
sage.misc.displayhook.format_obj before deferring to IPython's
standard method, so if we special case "type" there, we can avoid
reaching into the "formatter" list.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to