[IPython-dev] Extensible pretty-printing

Robert Kern robert.kern@gmail....
Thu Oct 28 21:38:55 CDT 2010


On 2010-10-28 20:17 , Fernando Perez wrote:
> On Thu, Oct 28, 2010 at 5:13 PM, Robert Kern<robert.kern@gmail.com>  wrote:

>> [1] Why a general JSONable object instead of just bytes? It would be nice to be
>> able to define a formatter that could give some structured information about the
>> object. For example, we could define an ArrayMetadataFormatter that gives a dict
>> with shape, dtype, etc. A GUI frontend could display this information nicely
>> formatted along with one of the other representations.
>
> Most of this I agree with.  Just one question: why not use real mime
> types for the type info?  I keep thinking that for our payloads and
> perhaps also for this, we might as well encode type metadata as
> mimetypes: they're reasonably standardized, python has a mime library,
> and browsers are wired to do something sensible with mime-tagged data
> already.  Am I missing something?

I guess you could use MIME types for the ones that make sense to do so. However, 
it would be nice to have an 'image' type that didn't really care about whether 
it was PNG or JPEG. There's no reason a frontend should have to look for every 
image/<format> MIME type that PIL can handle. We'd never actually *use* the MIME 
library anywhere. We'd treat the MIME types just like our own identifiers anyways.

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