[IPython-dev] [IPython-User] Runtime selection of the default pretty display
Matthias Bussonnier
bussonniermatthias at gmail.com
Mon Jun 2 04:10:29 EDT 2014
Le 1 juin 2014 à 22:42, Akim Demaille a écrit :
> Well, I think I agree with what you are saying, but let me
> reemphasize that my problem here is rendering automata.
> Small automata should be rendered with _repr_svg_, bigger
> ones should just display some metrics by default, such as
> their size. So I would have _repr_svg_ return None in such
> a case. And that's a means to control which _repr_ will
> chose. Except that it's decentralized: the logic of which
> _repr_ is 'enabled' is spread in each one of them. As a
> library author I do not want to prevent what the user
> will see, I'm trying to provide them with the best _default_
> behavior possible.
I understand, but your default make the assumption that the user is using
it in a live notebook and is focused on interactive usage.
inherently **choosing** one repr imply that others will not be computed and
not stored in the final document. It also start adding coupling between frontend and
kernel.
Also the _default_ value make little sens as it change depending on the context.
Do you run things headless ? Notebook app ? Emacs ? Will you convert it using nbconvert after ?
For me explicit is better than implicit, I wouldn't try to guess the best for the user.
>
> _repr_widget_ would be my best bet currently, as it allows
> me to select the best default behavior, and leave at the user
> the choice to select other formats.
For me widget are slower to use than keyboard and methods like
.png() , .svg(), text() as I have to reach the mouse.
> (And btw, I'm not pushing my users to call IPython.display
> at all, I'm really referring to the default display of values).
But they are not only displayed they are stored in _ and for later conversion.
Display is a side effect.
--
M
More information about the IPython-dev
mailing list