sys.exit(1) vs raise SystemExit vs raise

Random832 random832 at fastmail.com
Tue Apr 12 09:10:19 EDT 2016


On Tue, Apr 12, 2016, at 08:50, Ganesh Pal wrote:
> I m on python 2.7 and Linux ,  I have a simple code  need suggestion if 
> I
>  I could replace sys.exit(1) with raise  SystemExit .

No; raise SystemExit is equivalent to sys.exit(0); you would need raise
SystemExit(1) to return 1.

Why do you want to do this, though? What do you think you gain from it?



More information about the Python-list mailing list