[IPython-user] EOF for the cmd class

Justin Walker justin at mac.com
Thu Nov 25 14:04:46 CST 2004


On Nov 25, 2004, at 11:49, Fernando Perez wrote:

> 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 ;)

Another one of my youthful illusions shattered...man...

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

The say that experience is what you get when you don't get what you 
want...

>> 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.

Yeah; I typed it that way because I was using "return" as a verb, not a 
language element :=}.

Regards,

Justin

--
Justin C. Walker, Curmudgeon-At-Large  *
Institute for General Semantics        | "Weaseling out of things is 
what
                                        |  separates us from the animals.
                                        |  Well, except the weasel."
                                        |        - Homer J Simpson
*--------------------------------------*-------------------------------*




More information about the IPython-user mailing list