(BAW - why does supercite ruin code indentation when quoting???) >> There's a standard idiom for this: >> >> try: >> ...code... >> except KeyboardInterrupt: >> raise >> except: >> ...handler... aahz> May I suggest yet one more alteration: aahz> try: aahz> ...code... aahz> except (KeyboardInterrupt,SystemExit): aahz> raise aahz> except: aahz> ...handler... Which reminds me about a proposal I made here last November: http://mail.python.org/pipermail/python-dev/2001-November/018394.html Executive summary: Make KeyboardInterrupt inherit directly from Exception instead of from StandardError, so your standard idiom becomes: try: fragile code except StandardError: recover Anything that you might generally not want to trap (KeyboardInterrupt and SystemExit are the usual suspects, but Warning and StopIteration also fall into this category I think) should not inherit from StandardError. Skip
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