how to check if a value is a floating point or not
Grant Edwards
invalid at invalid.invalid
Fri Jun 20 10:28:52 EDT 2014
On 2014-06-20, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
> For the OP a very important rule of thumb is never use a bare except, so
> this is right out.
>
> try:
> doSomething()
> except:
> WTF()
IMO, that sort of depends on WTF() does. One case where a bare except
is well used is when stdandard output/error are not going anywhere
useful and you want to log the exception and then terminate:
try:
whatever()
except Exception as e:
syslog("foobar: terminating due to unhandled exception %s.\n" % e)
sys.exit(1)
Alternatively, if you're not at the top level in the call tree,
sometimes it's useful to log an exception but still pass it on up in
case somebody higher up wants to handle it:
def asdf():
try:
whatever()
except Exception as e:
syslog("Function asdf() terminating due to exception %s.\n" % e)
raise
--
Grant Edwards grant.b.edwards Yow! ... or were you
at driving the PONTIAC that
gmail.com HONKED at me in MIAMI last
Tuesday?
More information about the Python-list
mailing list