[Python-Dev] Assertions

Paul Prescod paulp@ActiveState.com
Tue, 21 Nov 2000 20:13:22 -0800

Tim Peters wrote:
> Why not?  I don't see any real difference between a core dump and an
> uncaught & unexpected Python exception:  in either case the program didn't
> get the job done, and left stuff in an unknown state.  

A core dump would kill Zope, PythonWin, Alice etc. An exception does
not. To me, that's a big difference. Also, Py_Object type checks are
extremely cheap in C code. And once we put in the parameter checks the
user will get an unexpected Python exception. Presumably they are not
building faulty XML trees on purpose!

Anyhow, I am won over despite your unpersuasive argument.

I note that minidom will not always give you an exception for a poorly
formed tree. That means that the programmer may not find her error until
the XML is "out of Python's hands." It should give an exception sooner
or later but not never.

 Paul Prescod