Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #106906

Re: sys.exit(1) vs raise SystemExit vs raise

From Random832 <random832@fastmail.com>
Newsgroups comp.lang.python
Subject Re: sys.exit(1) vs raise SystemExit vs raise
Date 2016-04-12 09:10 -0400
Message-ID <mailman.45.1460466627.15650.python-list@python.org> (permalink)
References <CACT3xuUFeOXbjwiWhgZ90UMPi5xXQaj9HpxU3Aepz2Hr8Kw42Q@mail.gmail.com> <1460466619.3532860.576358617.719C413A@webmail.messagingengine.com>

Show all headers | View raw


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?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: sys.exit(1) vs raise SystemExit vs raise Random832 <random832@fastmail.com> - 2016-04-12 09:10 -0400

csiph-web