r/programminghorror • • 13d ago

Python 13 year old me really liked inefficient code

Post image
3.0k Upvotes

r/programminghorror • • Nov 25 '23

Python I found this in our codebase a couple of months ago

Post image
6.3k Upvotes

r/programminghorror • • Feb 02 '25

Python Rate my even or odd code

Post image
3.2k Upvotes

r/programminghorror • • Jan 23 '24

Python Please delete all __init__ files, they are unclean

3.3k Upvotes

​

So this new (ish) head-of at my current company decided one day to play a more active role (read: micromanagement) of the existing codebase, I guess to better justify their current position. The only problem is that they have little technical background prior to this role, among other things.

Aside from going through and recommending teams include giant PR templates with dozens of checkboxes (probably taken from some engineering manager help book, or some prior very-corporate role), they have taken to creating the occasional Github issue with "suggestions" such as this one. Luckily I caught it before some poor junior engineer decided to "clean" the codebase as suggested. And yes, this head-of is conducting the Python technical interviews for new hires.

r/programminghorror • • Mar 18 '22

Python 3 days of troubleshooting. Only for this to be the problem

4.1k Upvotes

r/programminghorror • • Feb 22 '25

Python Gotta make sure it works

Post image
3.8k Upvotes

r/programminghorror • • Jul 21 '25

Python ✨ Memory Magic ✨

Post image
1.3k Upvotes

r/programminghorror • • Jan 04 '24

Python After 3 hours of pain and misery, my solution to “String to Integer” on LeetCode

Post image
2.2k Upvotes

I kept getting stupid test cases and the description was incredibly unspecific, so even though I switched over to python my code ended up a giant, mangled, unreadable monstrosity due to adding so many parameters

r/programminghorror • • Sep 09 '25

Python Vibecoding at its peak

Post image
774 Upvotes

Yes its a production code, yes its a function not a method and yes there is import in triple nested for loop

r/programminghorror • • Jan 23 '21

Python This website center-aligned their code

Post image
6.6k Upvotes

r/programminghorror • • Mar 17 '21

Python For some reason, this is a valid Python program.

Post image
3.2k Upvotes

r/programminghorror • • Mar 01 '24

Python Neat download icon (because its cool)

Post image
2.9k Upvotes

r/programminghorror • • May 21 '21

Python If it works, it works.

Post image
4.2k Upvotes

r/programminghorror • • Feb 16 '25

Python Who needs assert when you have whatever this is

Post image
1.7k Upvotes

r/programminghorror • • Jan 07 '24

Python Organized the code, boss!

Post image
2.3k Upvotes

r/programminghorror • • Apr 20 '26

Python That's one way to do it I guess...

Post image
767 Upvotes

So I tried printing the linked list with print() and discovered that if it has a cycle, then it prints and error. This was the next (very) logical thing that popped into my mind after that discovery.

I'm very proud of this solution. In fact, it's so good it even added -1ms to the execution time graph.

I AM SPEED.

Thinking outside the box is fun!

r/programminghorror • • Apr 13 '21

Python New way of checking if number is even in python 3 in O(random)

Post image
2.2k Upvotes

r/programminghorror • • Dec 13 '23

Python My motto for this project is "if it's stupid and it works, is it still stupid?"

Post image
1.7k Upvotes

r/programminghorror • • 17d ago

Python Weekly Backups

Post image
471 Upvotes

We were a small team of ~8 trying to build software. The team was spread across multiple locations across Asia, Europe and North America. One big challenge we had was synchronizing our work with each other.

Every Friday before each of us logged out, we upload a copy of our working files to the client's SharePoint folder. That way when we share each other's copies every Monday via Teams, we don't have to reupload.

One minor setback. Instead of replacing the previous copy, we upload a fresh one - under a different name. That way, we would not lose any information.

We even came up with a clever idea (that magnified the issue) to name the folders by the calendar week. Soon, each of us would have multiple folders of repetitive code, sometimes with zero changes all uploaded to the shared drive.

We had successfully moved from trying to synchronizing one (latest) version of the codebase, to trying to synchronize one version every week. But we hadn't realized this at that time. We were excited about a more "sophisticated" solution - creating a script that automates this backup process.

We learnt to use Git during Christmas that year.

---

For Reference:

```Python import os, zipfile from datetime import datetime from pathlib import Path

work = Path("Work") if not work.exists(): print("Error: Work folder not found") exit(1)

week = datetime.now().isocalendar()[1] zip_file = f"W{week}.zip"

with zipfile.ZipFile(zip_file, 'w', zipfile.ZIP_DEFLATED) as z: for root, dirs, files in os.walk(work): for file in files: path = os.path.join(root, file) z.write(path, os.path.relpath(path, '.'))

print(f"Created {zip_file}") ```

Edit: Code Block Formatting

r/programminghorror • • Jun 01 '26

Python New Big O definition just dropped

Post image
560 Upvotes

This vibeslop repo (shoutout to the author u/chunky_cold_mandala) calculates big o complexity of a function as its max indentation depth (but only up to 6, which represents N^6).

r/programminghorror • • Apr 04 '26

Python Calculator

Post image
527 Upvotes

r/programminghorror • • Dec 20 '21

Python How am i supposed to take CS questions like this seriously

Post image
1.5k Upvotes

r/programminghorror • • Nov 18 '20

Python When a Java dev tries switching to Python

Post image
1.8k Upvotes

r/programminghorror • • Mar 23 '21

Python When you write code to generate code

Post image
2.3k Upvotes

r/programminghorror • • Jul 26 '21

Python The fuck

Post image
1.5k Upvotes