Re: SystemExit

Jaap Vermeulen (jaap@sequent.com)
Mon, 10 May 1993 11:11:14 -0700

| without having to worry about the possibility that you never hit the
| finally clause. It is still possible but less likely during normal

I though you would *always* hit the finally clause, even if you use
sys.exit()? (I mean: wasn't this true for the previous version too?)

| code. Nobody in their right mind would use posix._exit(n) except to
| exit from a forked child, but lots of code may call sys.exit(n) -- as

True, still, os.py is broken on DOS.

| Code that uses an unqualified except clause is always suspect. It may
| mask exceptions caused deep inside that you didn't know were possible,
| such as SystemError, MemoryError or TypeError in code that you thought
| had no bugs.

Yes, I know. Listing all exceptions I want to catch in separate lines,
yet all of them using the same code, is a hassle (especially if there
are quite a few of them). Couldn't we add something that would allow
you to pass a list of exception types as the first argument to
except:?

Also, the whole stacktrace is a hassle. It is great for the developer,
but confusing for the ordinary user that doesn't care for it
(espacially if the python program is a subprogram of another program).
That's why often I wrap the whole program in a try: except:, forgoing
the stacktrace, but printing the problem (using the exc_type and
exc_value).

| try:
| "some code that may raise any exception"
| except SystemExit, status:
| raise SystemExit, status
| except:
| "handle any other kind of error"

Forgot about that one. :-)

Thanks,

-Jaap-

--
Jaap Vermeulen					+--------------------------+
						| Sequent Computer Systems |
	Internet : jaap@sequent.com		| Beaverton, Oregon	   |
	Uucp	 : ...uunet!sequent!jaap	+--------------------------+