<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br class="webkit-block-placeholder"></div><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px; ">The sample code (from Learning Python) is included below my signature. My question is: Do I need to inherit a most-generic exception class? Or, is a non-exception class sufficient?&nbsp;</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font class="Apple-style-span" face="Arial" size="3"><span class="Apple-style-span" style="font-size: 13px; "><br class="webkit-block-placeholder"></span></font></div></blockquote><div><br class="webkit-block-placeholder"></div>Currently no, you don't *need* to inherit from a most-generic<div>exception class, but in Python 3000 all&nbsp;exceptions must descend</div><div>from BaseException, so now is the time to start getting used to</div><div>the new world order.<br><div><div><br></div><div>In the current world, if my exceptions designate error conditions</div><div>of any kind then they descend from (at least) Exception. &nbsp;The</div><div>broad categories defined by Python are:</div><div><br class="webkit-block-placeholder"></div><div>BaseException - An exception, but not necessarily an error</div><div>Exception(BaseException) - An error</div><div>StandardError(Exception) - Generic error</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; ">ArithmeticError(Exception) - Bad math</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; ">LookupError(Exception) - Indexing error</div></div></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; ">EnvironmentError(Exception) - Something outside python</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><br class="webkit-block-placeholder"></div></div><div>Only when the exception is used for "normal" flow control do I see</div><div>a reason for inheriting directly from BaseException. &nbsp;This is the</div><div>pretty much the way Python does it too. &nbsp; GeneratorExit, StopIteration,</div><div>SystemExit, and KeyboardInterrupt are all about flow control, and not</div><div>errors per se, so they are BaseExceptions, but not&nbsp;Exceptions.</div><div><br></div><div>-jeff</div><div><br class="webkit-block-placeholder"></div><div><br></div></div></div></body></html>