RuntimeError?

Fred L. Drake Fred.L..Drake at p98.f112.n480.z2.fidonet.org
Tue Jun 29 20:02:26 CEST 1999


From: "Fred L. Drake" <fdrake at cnri.reston.va.us>


Tim Peters writes:
 > Honestly, I had never seen a RuntimeError before!  I found this one by

  Ooh, lucky you!  ;-)  Actually, I've seen very few.

 > digging thru the source code to see when it gets raised.  There's really no
 > pattern to it, and the RuntimeError docstring in Lib/exceptions.py

  When RuntimeError is raised by the interpreter itself, that seems to 
be the case.  When documenting modules, I've seen that a lot of them
do things like "raise RuntimeError" (note: no parameters) whenever
they need to raise an exception and the programmer hadn't already
defined an exception specific to the module.  I consider this a real
problem, since it becomes hard to catch just the right exception.  The 
ones I've seen in modules didn't seem to be so serious, just lazy
about defining new exceptions the might only get used in one place.
  I've not maintained a list of where I've see this, unfortunately:
fixing them would be a worthwhile activity.


  -Fred

--
Fred L. Drake, Jr.	     <fdrake at acm.org>
Corporation for National Research Initiatives




More information about the Python-list mailing list