[IPython-dev] Extensible pretty-printing

Robert Kern robert.kern at gmail.com
Thu Oct 28 11:03:35 EDT 2010


On 10/28/10 4:45 AM, Walter Dörwald wrote:
> On 27.10.10 17:37, Robert Kern wrote:
>
>> In the ticket discussion around my patch to restore the result_display hook,
>> Brian suggested that the real issue is what the extensibility API for this
>> functionality should be. I would like to propose the pretty extension as that
>> API. I propose that it should be integrated into the core of IPython as the
>> pretty-printer instead of pprint. pretty allows one to specify pretty-print
>> functions for individual types and have them used in nested contexts.
>>
>> Incidentally, this would resolve this issue by allowing the user to specify a
>> pretty-printer for floats:
>>
>>     http://github.com/ipython/ipython/issues/issue/190
>
> Are there plans to support something like pretty:
>
>     http://pypi.python.org/pypi/pretty
>
> which seems to be well thought out and extensible?

That is exactly what the discussion is about. We already have pretty as an 
extension, but the recent refactoring broke the extension hook it used pending a 
discussion about the general way to make extensible APIs for IPython components. 
I am suggesting that pretty should be the extensible API for the pretty-printing 
that IPython does.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the IPython-dev mailing list