On Wed, Jan 4, 2017 at 8:41 AM,  <breamore...@gmail.com> wrote:
> Hi all, I'd suggest that this 
> http://blog.pyspoken.com/2017/01/02/how-best-to-coerce-python-objects-to-integers/
>  is not one of the greatest articles ever written about Python exception 
> handling.  Other opinions are welcome.
>

"""
So there you have it. I’m happy with this function. It feels
bulletproof. It contains a naked except, but that only covers one
simple line of code that’s unlikely to hide anything nasty.
"""

Yep! It's perfect. He has successfully made a function that won't leak
any exceptions. Congratulations!

The novice believes that the first priority is to stop the program
from crashing. The expert understands that crashing (especially with
an exception, but even a segfault) is actually very helpful and
useful.

I love the logic that a bare 'except' is okay as long as it's only
covering one single line of code. There's almost enough truth in that
to be meaningful, while still completely missing the point that a
NameError is almost certainly a bug no matter where it crops up.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to