[IPython-user] no output in ipython under emacs...
a.schmolck at gmx.net
Sat Mar 25 16:53:10 CST 2006
SK <skokot at o2.pl> writes:
> I have a script.py buffer and ipython buffer open in emacs. Consider the
> following cases:
> 1) the command typed in ipython buffer
> In : string.join(string.split('xxaaxxaa', 'aa'), 'CC')
> Out: 'xxCCxxCC'
> 2) in script.py buffer, a marked command:
> string.join(string.split('xxaaxxaa', 'aa'), 'CC')
> is executed with "C-c |", I get no output!
> In : ## working on region in file /tmp/python-9432Hxi.py...
> 3) the same as case 2) but added print command:
> print(string.join(string.split('xxaaxxaa', 'aa'), 'CC'))
> the result is:
> In : ## working on region in file /tmp/python-9432U7o.py...
> So the conlusion is that when executing a region from a file.py buffer (case 2),
> I get no output which is quite confusing in comparison to the same command typed
> in ipython buffer.
> Should it work like that?
Well, it's certainly intended to work that way although I'm sure one could
argue about the best behaviour. I haven't run plain python from emacs for a
long time, but I'm pretty sure that's what happens there, too (on even
flimsier evidence, I'd venture the same happens in idle, as well).
I guess the logic is that if you evaluate something in the shell, you do so to
see some results (or else you append a ;), whereas if you evaluate part of a
buffer you mostly do that to update the current state of the interactive
session (i.e. for side-effect) and you wouldn't want some potentially big repr
that arises as a side-effect printed out without having any control over it in
these cases (reprs might also be quite expensive to create -- think some big
(oldstyle) array, or even, in rare cases cause errors).
Actually, I suppose the ideal behaviour would be to optionally briefly display
the result in the status line, truncating as necessary (if you agree and have
some time on your hands, you could always submit a patch to make that an
More information about the IPython-user