[IPython-dev] Multiple outputs per input line

Thomas Kluyver takowl at gmail.com
Sun Mar 13 12:26:04 EDT 2011

I realised that it's possible to get multiple outputs from a single input
line. Most trivially, you can do "for a in range(5): a", to produce 5
outputs. At present, this crashes my sqlite-history branch if output logging
is enabled, because it expects each output item to have a unique session and
line number. In fact, the session output history doesn't really expect it
either: it only stores the last result.

It should be simple enough to catch the error in writing to the database,
and only store the first result, or to use an SQL update statement so we
only store the last result. Is that good enough for what I think is a fairly
unusual case? Or do we want to work out a way of storing all the outputs
from a command? Robert, logging output to the database was your suggestion,
so perhaps you've got an opinion?

(Of course, I can relax the restriction that session and line number must
together be unique, but then getting useful information from the database
becomes trickier.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20110313/dbd6fa85/attachment.html>

More information about the IPython-dev mailing list