On 07 November 2001, Skip Montanaro said: > I have a simple proposal: Change the exception class hierarchy > slightly, so that exceptions you generally will want to re-raise don't > inherit from StandardError. Currently, SystemExit, StopIteration and > Warning inherit directly from Exception. I suggest that > KeyboardInterrupt should also inherit from Exception, and not > StandardError. Sounds reasonable to me. Greg Ward writes: > Hmmm... does anyone else habitually write > > if __name__ == "__main__": > try: > main() > except KeyboardInterrupt: > sys.exit("interrupted") It must be you, Greg! ;-) The only thing I can think of that I do similar to that is: import errno if __name__ == "__main__": # do setup stuff... ... # output result to file... try: write_result() # or whatever it really is... except IOError, e: if e.errno != errno.EPIPE: raise -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4