[IPython-dev] Ascii imshow

Fernando Perez fperez.net at gmail.com
Sat Feb 12 20:40:11 EST 2011


Hey, Sat, Feb 12, 2011 at 10:42 AM, Brian Granger <ellisonbg at gmail.com> wrote:
>
> Do you think it would make sene to implement this as an object that
> has special print methods like __pretty__, __png__, etc.  That would
> make it super easy to add support for other frontends.

Mmh, interesting...  Initially I thought of this as a purely
functional thing, a terminal version of imshow() and nothing else.
But what you're thinking of is connecting it to our extended display
system... I actually do like that, especially since it would be code
coming from IPython.

Here's a suggestion.  Considering:

1. That Nicolas is new to IPython development and not likely to know
all the details of the new display design.

2. That we're still sorting out (in the other thread) precisely how we
want to go about that design, after some of the concerns Robert
raised.

I propose that we go for now with a purely functional implementation
(basically a cleaned up, documented and tested version of Nicolas
current code, but with the same overall approach).  This will make it
easier for Nicolas to contribute his work now.  But we keep this as a
prime candidate to test out the display system, and once we finalize
the design decisions, it can be refactored in that direction.  The
refactoring would be very easy, since it's basically replacing the
current printing with assembling a string to be the return value of
the repr.

I now realize this is probably the best course of action for another
reason: in its current form, the code works even with the plain
terminal ipython that has no knowledge of the full display machinery.
If we move it to that model, I think it wouldn't quite work in our
current terminal client (correct me if I'm wrong).

Does that sound reasonable?

Cheers,

f



More information about the IPython-dev mailing list