[IPython-user] printing lots of stuff to the screen
Stefan van der Walt
stefan@sun.ac...
Fri May 25 02:33:58 CDT 2007
On Thu, May 24, 2007 at 11:20:44PM -0600, Fernando Perez wrote:
> On 5/24/07, Jerry McRae <qrs0xyc02@sneakemail.com> wrote:
> > I believe it is a property of the shell, not IPython. You didn't say what
> > OS you are using.
>
> Yup. Ryan is, I think, on Windows, so your advice is spot on. Under
> linux, I use KDE's konsole, which has a similar option for setting the
> size of the scrollback buffer. Most terminal emulators offer such an
> option somewhere, but it's not something that IPython, being
> line-oriented and all, has any control over as of this time.
This sounds like a job for ipipe. Attached is a patch for a new
command called "icap", that captures any printed output of a given
command. For example
from ipipe import icap
def foo(n):
for i in range(n):
print "We have %s results." % str(i+1)
icap("foo(100)")
which yields a browsable
ibrowse #0: icap('foo(100)')
# |_ |
0 |We have 1 results..|
1 |We have 2 results..|
2 |We have 3 results..|
3 |We have 4 results..|
4 |We have 5 results..|
5 |We have 6 results..|
etc.
This is just a proof of concept. I don't know the internals of ipipe
or ipython well, so there may be better ways to implement it.
Cheers
Stéfan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipipe.diff
Type: text/x-diff
Size: 1723 bytes
Desc: not available
Url : http://lists.ipython.scipy.org/pipermail/ipython-user/attachments/20070525/7a7212a2/attachment.bin
More information about the IPython-user
mailing list