[IPython-user] The new Moin-based site is up.

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Sep 28 08:06:41 CDT 2006


>>>>> "Brian" == Brian Granger <ellisonbg.net at gmail.com> writes:

    >> Let it be noted here and forever more, I was the first
    >> contributor!
    >> 
    >> http://ipython.scipy.org/moin/InterruptingThreads

    Brian> Most excellent - especially given the content.

You might consider adding kbint (ipbreak in the wiki), or a variant of
it to IPython.Shell, and that way you hide the implementation details
of KBINT and can manage the state yourself.

# in Shell.py

def kbint(): 
    if kbint.KBINT:
        kbint.KBINT = False
        raise KeyboardInterrupt
kbint.KBINT = False

The end-user could then simply do

from IPython.Shell import kbint

for data in mydata:
    do_something_expensive()
    kbint()


Hmm, but then my first wiki page would already be obsolete :-(

JDH



More information about the IPython-user mailing list