Will McGugan <[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] wrote:
>> 
>> sys.exit() raises a SystemExit, see
>> http://docs.python.org/lib/module-sys.html
>> 
> Oh I know. I was just wondering if there was some sort of subtle 'best 
> practice' recommendation that I wasnt aware of for using sys.exit over 
> raising the exception manually. In the same way that 'open' is prefered 
> over 'file', even though they appear to do the same thing.

'open' is preferred when you are opening a file, 'file' is preferred when 
it is the type you want. That way you leave open the option to intercept 
the 'open' action without interfering with tests against the type.

I guess in a similar way you should prefer the overridable sys.exit() 
function rather than using the exception directly.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to