Roy Smith wrote:
Skip Montanaro wrote:
   246 ValueError
   227 aetools.Error
   216 Error
   124 TypeError
   101 error
    75 RuntimeError
    53 IOError
    36 NotImplementedError
    36 ImportError
    36 EOFError
    31 SyntaxError
    23 KeyError
    23 AttributeError
    22 DistutilsPlatformError
    21 UnicodeError

It's kind of interesting (scarry?) that in roughly 20% of the cases nothing more specific than Error is raised.

(In case someone reading doesn't know) there isn't actually an "Error" in the standard set of exceptions. It seems likely that pretty much all of those uses are actually module-specific Errors, and as such they are probably much more specific than the unadorned name might imply.

Also, when one is trying to pick an appropriate exception
to raise, it is often the case that none of the standard
exceptions seems appropriate.  In those cases (although I
personally would prefer a different name than "Error")
there's often no good alternative to making your own
unique module-specific Exception subclass.

-Peter
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to