"Phillip J. Eby" <pje at telecommunity.com> writes: > At 12:52 PM 9/30/04 -0300, Lalo Martins wrote: >>On Thu, Sep 30, 2004 at 10:19:22AM -0400, Phillip J. Eby wrote: >> > >> > Also, maybe in 2.5 we could begin warning about bare excepts that aren't >> > preceded by non-bare exceptions. >> >>try: >> foo() >>except: >> print_or_log_exception_in_a_way_that_is_meaningful() >> raise >> >>doesn't seem to be incorrect to me. For example, if the program >>is a daemon, I want the exception logged somewhere so that I can >>see it later, because I won't be watching stderr. > > 1. If the exception raised is a MemoryError, your daemon is in trouble. Not necessarily. Typing 'range(sys.maxint)' into the interactive interpreter gives a fairly harmless MemoryError (the only exception PyRepl doesn't catch is SystemExit). > 2. I said *warn*, and it'd be easy to suppress the warning using > except Exception:', if that's what you really mean Well, apart from the fact that this doesn't catch, uh, exceptions that don't derive from Exception? Until/unless that's enforced (something that gets thrashed around every other month) there's still a place for 'bare except:'. Cheers, mwh -- SCSI is not magic. There are fundamental technical reasons why it is necessary to sacrifice a young goat to your SCSI chain now and then. -- John Woods
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