23
Tried using Python lists instead of dictionaries for a project and it bit me hard
So last weekend I was coding a little app to track my game collection. I had to decide between using lists or dictionaries to store the data. I figured lists were simpler so I went with that. Big mistake. After like 3 hours of writing loops to find specific games by name I realized dictionaries would have just let me look stuff up instantly. My code turned into a mess of nested loops and I ended up rewriting the whole thing Sunday morning. Now I get why everyone says pick the right structure from the start. Has anyone else wasted a whole afternoon on a dumb data structure pick?
2 comments
Log in to join the discussion
Log In2 Comments
andrew8541mo ago
But weren't you just overcomplicating things? Lists are fine if you plan your data access patterns ahead of time instead of just winging it.
8
olivia_murphy1mo ago
oh man, I've been there. spent a whole saturday building a to-do list app with lists and ended up writing a custom search function with like 14 nested loops just to find items by date. my code looked like spaghetti thrown at a wall. dictionaries would've solved it in one line. sometimes you gotta learn the hard way that convenience beats simplicity every damn time.
0