On Tue, 14 Mar 2023 at 15:28, Thomas Passin 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;
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,
On 3/13/2023 11:50 PM, MRAB wrote:
On 2023-03-14 03:29, Thomas Passin wrote:
On 3/13/2023 10:34 PM, scruel tao wrote:
Lars:
I totally understand your reasoning here, but in some way it
follows the unix philosophy: Do only one thing, but do that good.
I understand, python is not strongly
On 2023-03-14 03:29, Thomas Passin wrote:
On 3/13/2023 10:34 PM, scruel tao wrote:
Lars:
I totally understand your reasoning here, but in some way it
follows the unix philosophy: Do only one thing, but do that good.
I understand, python is not strongly typed, so `sys.exit` will be
able to
On 3/13/2023 10:34 PM, scruel tao wrote:
Lars:
I totally understand your reasoning here, but in some way it
follows the unix philosophy: Do only one thing, but do that good.
I understand, python is not strongly typed, so `sys.exit` will be
able to accept any types parameters rather than just
Lars:
> I totally understand your reasoning here, but in some way it follows the unix
> philosophy: Do only one thing, but do that good.
I understand, python is not strongly typed, so `sys.exit` will be able to
accept any types parameters rather than just integer.
In order to handle such
On 13Mar2023 10:18, scruel tao wrote:
Chris:
but for anything more complicated, just print and then exit.
It's worth noting, by the way, that sys.exit("error message") will
print that to STDERR, not to STDOUT, which mean that the equivalent
is:
Yes, I know, but don’t you think if `sys.exit`
I totally understand your reasoning here, but in some way it follows the unix
philosophy: Do only one thing, but do that good.
And exiting is something different from printing to STDOUT or STDERR. Yes
sometimes you want to print something before exiting. But then you should do
that explicitly
Chris:
> It doesn't actually take a list of arguments; the square brackets
indicate that arg is optional here.
Oh, I see, it seems that I mistunderstood the document.
> but for anything more complicated, just print and then exit.
> It's worth noting, by the way, that sys.exit("error message")
On Mon, 13 Mar 2023 at 20:00, scruel tao wrote:
>
> Currently, I use `sys.exit([arg])` for exiting program and it works fine.
> As described in the document:
> > If another type of object is passed, None is equivalent to passing zero,
> > and any other object is printed to stderr and results in
Currently, I use `sys.exit([arg])` for exiting program and it works fine.
As described in the document:
> If another type of object is passed, None is equivalent to passing zero, and
> any other object is printed to stderr and results in an exit code of 1.
However, if I want to exit the program
11 matches
Mail list logo