On Tue, 14 Mar 2023 at 15:28, Thomas Passin <li...@tompassin.net> wrote:
>
> On 3/13/2023 10:34 PM, scruel tao wrote:
> > Interesting, `raise SystemExit` seems to have the same behavior as 
> > `sys.exit`:
> >
> > ```shell
> > python -c "raise SystemExit(100)"
> > echo $?
> > <<< 100
> >
> > python -c " import sys; sys.exit(100)"
> > echo $?
> > <<< 100
>
> OTOH, you don't want to get too tricky:
>
> (on Windows, obviously)
> C:\Users\tom>py -c "import sys; sys.exit(type(100) == type('a'))"
>
> C:\Users\tom>echo %ERRORLEVEL%
> 0
>
> Presumably we wouldn't want to get an exit value of 0 for this case!
>

Why? You passed the value False, which is 0. So it should behave as
documented, and exit 0.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to