Errors are Good

Errors are good. I remember when I first started coding (I'm talking like I'm some grizzled vet, but it's been less than year) and I would get annoyed, frustrated, even angry when I would run my code and get an error. Sometimes I would yell "What?!" out loud or even pound my fist on my desk. I saw it as a bad thing.

But they're not a bad thing. They're a great learning tool. Eventually I got to the point where I expected, sometimes even kind of hoped for errors. Why? Because they're a learning experience. I've learned tons from the bugs in my code, from trial and error, from running it and running it until it came out clean.

Dealing with errors invites you to get good at solving problems. Why is there an error? What does it mean 'int' is not iterable? How do I fix that? What type does the program expect here? How can I get it to that type? What arguments does this function expect? What does the documentation say? And so on.

I learned tons about types in Python, about iterations and loops, about list slicing and dictionary keys, and more just from all the errors I compiled trying to get my darn code to run. It's a cliche, but it's true: mistakes are one of the best ways to learn. And mistakes with no consequences AND with immediate feedback telling you you made a mistake are the best mistakes to learn from - and that's exactly what code error messages give you.

Sometimes the best thing to do is just run the code and see what the error message is. It will point you in the right direction far more often than it makes you more confused. Eventually you'll get good at recognizing the error messages as well - you'll know what the error means, and quickly be able to troubleshoot what caused it. You might even intentionally cause an error just to see what the code expects in a given situation.

So embrace the fact that you're going to make mistakes. Even look forward to them. They are useful. They will teach you to be better. They are good.