Don't use bare try-except blocks in Python! #python #coding #programming #computerscience

preview_player
Показать описание
Don't use bare try-except blocks in Python!

This can lead to a program catching all sorts of errors that you generally don't want to catch, with some examples being undefined names and keyboard interrupts (Ctrl-C). Speaking from first hand experience, it can make debugging much more difficult as well.

Follow @codeaffinitydev to learn more about python, coding, and tech!

#python #pythondeveloper #coding #programmer #programming #computerscience #knowledge #code #pythontutorial
Рекомендации по теме
Комментарии
Автор

And if you still want to catch every Error, you can use `except Exception:`, since all usual errors inherit from Exception, but not KeyboardInterupt (which inherits from BaseException directly).

davidc.
join shbcf.ru