[IPython-user] EOF for the cmd class

Fernando Perez Fernando.Perez at colorado.edu
Thu Nov 25 13:49:02 CST 2004

Justin Walker wrote:

> I've now figured that out.  FWIW, my (1st edition) Learning Python book 
> gives this (sys.exit) as the way to exit from the command loop, and I 
> was just faithfully following, sheep-like.

Don't believe everything books tell you ;)

Just kidding, LP is a good book.  I learned to not use sys.exit() as a normal 
termination hook more out of experience.

> Haven't figured out how to exit the command loop yet.  It appears that 
> 'return' from any of the 'do_' hooks will just go back into the command 
> loop, and I have yet to find documentation that describes how to deal 
> with this.  Time to UTSL: OK, return 'True'.  I guess I missed that in 
> the doc :-}

BTW, it's "return True", not "return 'True'".  If you return 'True', it still 
works b/c the 'True' string evaluates to True, but the True boolean is 
unquoted.  Minor nit.



More information about the IPython-user mailing list