[Python-Dev] Breaking bug #411881 into manageable pieces (original) (raw)

Aahz aahz@pythoncraft.com
Wed, 20 Mar 2002 15:38:02 -0500


On Wed, Mar 20, 2002, Tim Peters wrote:

[Aahz]

May I suggest yet one more alteration: try: ...code... except (KeyboardInterrupt,SystemExit): raise except: ...handler... Not unless you want to run around editing hundreds of modules. To quote someone who shall remain anonymous: The joy of coding Python should be in seeing short, concise, readable classes that express a lot of action in a small amount of clear code -- not in reams of trivial code that bores the reader to death.

How many bare except: clauses that should be bare are there? To my way of thinking, requiring the above construct on top of a bare except: is precisely the kind of wart we wish to encourage in order to discourage bare except: clauses. In any event, it was Guido's idea to add the

except KeyboardInterrupt:

in the first place; I'm simply adding the logical extension. Perhaps instead of the StandardError idea suggested by others, we should add a new exception called ExitException that inherits from both SystemExit and KeyboardInterrupt.

Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/

The best way to get information on Usenet is not to ask a question, but to post the wrong information. --Aahz