[Python-Dev] quit() on the prompt

Steve Holden steve at holdenweb.com
Wed Mar 8 13:39:51 CET 2006


Oleg Broytmann wrote:
> On Wed, Mar 08, 2006 at 12:37:47AM +0100, Thomas Wouters wrote:
> 
>>Raising SystemExit("quit() called") has an additional benefit (although the
>>wording could use some work):
>>
>>
>>>>>raise SystemExit("quit() called")
>>
>>quit() called
>>
>>(At least, I consider that a benefit :-)
> 
> 
>    It has a bad side-effect of returning an error code to the calling
> shell:
> 
> $ python && echo Ok || echo Error\!
> Python 2.4.2 (#1, Oct  3 2005, 20:57:52) 
> [GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> 
>>>>raise SystemExit("quit() called")
> 
> quit() called
> Error!
> 
> (At least, I consider that a bad side-effect.)

I should imagine the use cases for running an interactive Python shell 
as a part of a script are fairly few and far between, though.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd                 www.holdenweb.com
Love me, love my blog         holdenweb.blogspot.com



More information about the Python-Dev mailing list