[Python-Dev] quit() on the prompt

Oleg Broytmann phd at mail2.phd.pp.ru
Wed Mar 8 12:45:55 CET 2006


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

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-Dev mailing list