Skip to content
markdown guide

The classic fork bomb is pretty terrifying:

:(){ :|:& };:

The function is called :. Call it scaryFunc instead:

scaryFunc() {
    scaryFunc() | scaryFunc() &
}; scaryFunc

This function recursively calls itself, then pipes it to another call of itself that gets put in the background with &, meaning the child will not die and just continually recursively call itself, blocking everything else, until it's maxed out your system resources and you crash. It's even multiple-recursive, for extra oomph. After defining the function, we call it.

Don't do this.


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.

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 😬


I agree with Ben Lovy... typical forkbomb like this one in C

#include int main(void) { while(1) fork(); }

But even scarier is

DROP FROM Users; WHERE id = 1

or something like deleting the column from table in production database like:

ALTER TABLE Users DROP username;


Sorry, my one liner is so scary even I'm too scared of writing it down.


Something I actually did. On production. But luckily before going live with a new service.

DELETE FROM products;

Since that day, I always BEGIN and either ABORT or COMMIT after triple-checking.

Classic DEV Post from Aug 4 '19

You're not worth hiring unless...

Ankit Beniwal 🙂 profile image
Love to jump in at the deep end.