In Python 2.5.2, I notice that, in the interpreter or in a script, I can exit 
with:

    exit()

But I don't see exit() mentioned as a built-in function; rather the Python 
Library Reference says we should use sys.exit(). Also, the reference says 
sys.exit() is like raising SystemExit. But so is just calling exit(). For 
instance,

    exit('some error message')

has the same apparent effect as 

    raise SystemExit, 'some error message'.

Both return a status code of 1 and print the error string on the console.

Is exit() documented somewhere I haven't been able to find? Is there any reason 
to use sys.exit() given exit()'s availability?

If there is an advantage to sys.exit() over exit(), then does sys.exit() have 
any advantage over "raise SystemExit, 'some error message'" in cases where a 
module has no other reason to import sys?

-- 

Gary Robinson
CTO
Emergent Music, LLC
personal email: [EMAIL PROTECTED]
work email: [EMAIL PROTECTED]
Company: http://www.emergentmusic.com
Blog:    http://www.garyrobinson.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to