The following is the Python form of one of the most insidious anti-patterns in all of programming. The scary one-liner is the third line.
try:someImportantFunction()except:pass
Mike Pirnat aptly calls that the "Diaper Anti-Pattern". It's horrific because it silences all errors, expected and otherwise, leaving your program in an unresolved exceptional state with few, if any, clues as to what's wrong.
Always, always explicitly catch and handle (or at least log) your exceptions. Unhandled exceptions should always crash your program. Period.
From the Zen of Python:
Errors should never pass silently.
Unless explicitly silenced.
If you're using anything resembling the diaper anti-pattern in any language, go fix it now. Seriously. Right now. Don't make me call your mother.
Here's a runner up from Python 2...
True,False=False,True
Thankfully, that one is no longer possible in Python 3.
The boolean-swapping allowed by Python 2 is a great one π I remember when I first discovered that True and False were just builtin, mutable, global variables π¬
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The following is the Python form of one of the most insidious anti-patterns in all of programming. The scary one-liner is the third line.
Mike Pirnat aptly calls that the "Diaper Anti-Pattern". It's horrific because it silences all errors, expected and otherwise, leaving your program in an unresolved exceptional state with few, if any, clues as to what's wrong.
Always, always explicitly catch and handle (or at least log) your exceptions. Unhandled exceptions should always crash your program. Period.
From the Zen of Python:
If you're using anything resembling the diaper anti-pattern in any language, go fix it now. Seriously. Right now. Don't make me call your mother.
Here's a runner up from Python 2...
Thankfully, that one is no longer possible in Python 3.
The boolean-swapping allowed by Python 2 is a great one π I remember when I first discovered that
True
andFalse
were just builtin, mutable, global variables π¬