I want to handle errors for a program i'm building in a specific way, but I don't want to use try/except/finally because it requires forming new blocks of code. I want to be able things like this:
a = [2, 423, "brownie", 234.34] try: a[890] except IndexError: # I don't use 'finally' here because I specifically want to check for an IndexError sys.exit("That number is way too big!") But sometimes you can have too many of these statements in your program, and it starts to get tangled and nasty looking. Is there a way I can modify sys.error so that when the interpreter comes accross an IndexError it prints "That number is way too big!" before it exits? -- http://mail.python.org/mailman/listinfo/python-list