IPython colors in windows

Fernando Perez fperez.net at gmail.com
Fri Feb 4 20:25:56 EST 2005


Ashot wrote:

> One more thing I was wondering about: why not highlight the source code in
> the errors since you already have this functionality (with '??' command).
> It would be nice to have it highlighed on the prompt as well, but I
> imagine this may be more difficult.. I've been using IPython for about a
> week and thats one of the two things I miss..

On the input line, there's no way: ipython only gets what you type when you hit
return.  It would require writing a full-blown IDE to get that.

For the errors, it's a bit tricky because I'd have to use the tokenization code
right inside the exception traceback builder.  That's not particularly easy,
esp. considering that the traceback handler doesn't necessarily have full code
objects.  Tokenizing a chunk of code which may begin half-way through a
function, with possibly an open triply-quoted multiline string in the middle,
can get tricky.

I'm not saying it's impossible, but it's certainly not a very straightforward
task.  I simply haven't found it to be a priority, given that other parts of
ipython need a lot more work.  Heck, those tracebacks are already miles ahead
of what you get from plain python (try 'xmode verbose' for real detailed
info), so for now I'm willing to leave them as they are.

But since it's definitely something which would be a nice improvement, I'll
gladly accept any patches which implement it in a clean, robust way.

Regards,

f




More information about the Python-list mailing list