Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use display instead of send_figure in inline backend hooks #2271

Merged
merged 2 commits into from
Aug 10, 2012

Conversation

minrk
Copy link
Member

@minrk minrk commented Aug 9, 2012

This lets custom display functions (e.g. HTML) be used without any extra changes (see #2234).

possible downsides:

  • The previous code guarantees that only one format is published. If multiple figure formatters are registered, display will send them all.
  • If people for some reason disable the type-printers, then they will display the automatic figure display.

Neither of these cases can come up unless people are messing with the formatters, and I think the first is actually an improvement.

This lets custom display functions (e.g. HTML) be used without any extra changes (see ipython#2234).

possible downsides:

* The previous code guarantees that only one format is published. If multiple figure formatters are registered, display will send them all.
* If people for some reason disable the type-printers, then they will display the automatic figure display.

Neither of these cases can come up unless people are messing with the formatters, and I think the first is actually an improvement.
@ellisonbg
Copy link
Member

Do we use send_figure anywhere else?

@ellisonbg
Copy link
Member

Overall, I like this idea. In some situations, I could imagine a user would want multiple formats sent back. I also like using the standard display API calls as much as possible.

@minrk
Copy link
Member Author

minrk commented Aug 9, 2012

Do we use send_figure anywhere else?

I had thought so, but apparently not. Should I just remove it?

@minrk
Copy link
Member Author

minrk commented Aug 9, 2012

Overall, I like this idea. In some situations, I could imagine a user would want multiple formats sent back. I also like using the standard display API calls as much as possible.

I think this is just an artifact of concurrent development, where send_figure used to be used by display or something, but now it's just a parallel implementation of the same thing, which should be recombined.

@ellisonbg
Copy link
Member

I think that send_figure was implemented before (summer 2010) the general display protocol was in place (spring 2011). I am +1 on removing it.

@fperez
Copy link
Member

fperez commented Aug 10, 2012

On Thu, Aug 9, 2012 at 3:52 PM, Brian E. Granger
notifications@github.comwrote:

I think that send_figure was implemented before (summer 2010) the general
display protocol was in place (spring 2011). I am +1 on removing it.

I won't shed a tear either...

@minrk
Copy link
Member Author

minrk commented Aug 10, 2012

send_figure removed

@fperez
Copy link
Member

fperez commented Aug 10, 2012

+1. display() is essentially our (fancy, shmanzy) version of print, so the more consistently we use it the better. Having figures use their own special code path will bite us some day, might as well preclude that possibility altogether.

Merging now.

fperez added a commit that referenced this pull request Aug 10, 2012
use display instead of send_figure in inline backend hooks

This lets custom display functions (e.g. HTML) be used without any extra changes (see #2234).

possible downsides:

* The previous code guarantees that only one format is published. If multiple figure formatters are registered, display will send them all.
* If people for some reason disable the type-printers, then they will display the automatic figure display.

**Backwards-incompatible change**

Note that `IPython.zmq.pylab.backend_inline.send_figure` has been removed, as `display()` can do the same job and we avoid an unnecessary special-case code path.
@fperez fperez merged commit 4a1728a into ipython:master Aug 10, 2012
@minrk minrk deleted the display_send_figure branch March 31, 2014 23:36
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
use display instead of send_figure in inline backend hooks

This lets custom display functions (e.g. HTML) be used without any extra changes (see ipython#2234).

possible downsides:

* The previous code guarantees that only one format is published. If multiple figure formatters are registered, display will send them all.
* If people for some reason disable the type-printers, then they will display the automatic figure display.

**Backwards-incompatible change**

Note that `IPython.zmq.pylab.backend_inline.send_figure` has been removed, as `display()` can do the same job and we avoid an unnecessary special-case code path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants