9
Just realized why my first Python script kept crashing after 100 lines
I kept writing everything in one giant block of code because I thought functions were for later. My script to rename files would just stop halfway through. After it failed for the third time, I looked it up and saw a post saying to break code into small, named parts. I tried making one function just to check if a file exists, and suddenly I could see where the error was. Has anyone else hit a wall because they tried to do too much at once without splitting it up?
2 comments
Log in to join the discussion
Log In2 Comments
the_angela6d ago
My first real project was a 200 line monster that just gave up halfway through a web scrape. I called it "script_final_final_v3.py" and refused to use functions because it felt like extra work. The debugger just pointed to line 147, which was, of course, in the middle of a huge mess. Breaking it into pieces felt like admitting defeat, but then I could actually see the dumb typo hiding in plain sight.
6
oscar6666d ago
How many of us have that same script in our history?
0