6
Can we talk about how I wrote the same code block ten times before I got it?
I was making a simple Python script to rename files, and for a week I kept copying and pasting the same five lines of code every time I needed it. Then I saw a comment on a Stack Overflow post that just said 'make a function, dude'. I felt so dumb. How do you know when to stop copying code and start making it reusable?
2 comments
Log in to join the discussion
Log In2 Comments
elizabethhart10d ago
My friend spent a whole month manually editing timestamps in his photo filenames, like one by one. He finally showed me his process and it was the same three commands pasted over and over in his terminal history. I told him to just write a tiny script and save it, and he looked like he'd been struck by lightning. He said he just never thought to stop and fix the process itself.
3