[IPython-dev] New display methods, should we fine-tune our naming decision?

Brian Granger ellisonbg at gmail.com
Tue Feb 1 19:21:18 EST 2011


On Tue, Feb 1, 2011 at 2:24 PM, Robert Kern <robert.kern at gmail.com> wrote:
> On 2/1/11 1:32 PM, Alex Gaynor wrote:
>
>> Be careful with __html__ (Django doesn't support it, I think all the others you
>> named do), it's not really intended to handle HTML formatting of an object, but
>> really just manage whether or not it's supposed to be escaped or not.
>
> Right. It's a tool for frameworks/template libraries to implement internal
> SafeString/Markup/whatever objects, not for application/library authors to make
> HTML representations of their model objects. If a Jinja2 user is viewing a
> Markup object in IPython, they want to see "Markup(u'<p>foo</p>')", not an
> HTML-formatted "foo". The HTMLFormatter's behavior is undesirable, and I think
> this is a good reason to avoid using __html__, at least.

OK, this is very useful information.  Let's find a different naming
convention for these.  What do people prefer?

Also, Robert, do you think we need to change the priority of the
special method/print function logic?

Brian

> --
> 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
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



-- 
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu
ellisonbg at gmail.com



More information about the IPython-dev mailing list