Small Mistakes, Deep Learning
Recently, I made a trivial yet fatal mistake in a project. I forgot to include self
when calling a class method. As a result, I was confronted with the error message:
update_existing_billing_task() takes 1 positional argument but 2 were given
At first, I couldn’t understand why I was getting this error. After reviewing the code several times, I finally realized that I had skipped self
when calling the class method. It was such a basic mistake. Upon discovering this, I felt a wave of emptiness and embarrassment.
Why Did I Make Such a Mistake?
Looking back, I can think of a few reasons why this mistake occurred.
- Automated Thinking
While developing, there are times when I unconsciously handle familiar tasks. In this process, it’s common to overlook details. I knew I had to use
self
, but I guess I got so absorbed in writing the code that I made this mistake. - Illusion from Error Messages
The message "1 positional argument is required but 2 were given" certainly explains the cause, but initially, it only led me to wonder, "Where did the 2 come from?" This delayed my understanding of the core problem.
- Complacency from Familiarity
As my understanding of the relationship between classes and methods deepens, I tend to overlook such basic mistakes.
How Can I Reduce Such Mistakes?
- Take a Break and Step Away from the Code
When you dive too deep, your perspective tends to narrow. Just taking a short break and returning to the code can provide a fresh viewpoint.
- Review Basic Syntax Again
When an error isn't resolved, it's a good habit to review the fundamentals again. Reviewing my code with a beginner's mindset can be helpful.
- Review as if It Were Someone Else's Code
When I think my code is perfect, mistakes often go unnoticed. If I approach it as if it were written by someone else, I can identify problems more easily.
Finally
Developers are not perfect beings who never make mistakes. I am one of them. What matters is the attitude of learning and growing through mistakes. By being a little more lenient with ourselves, and striving to reduce mistakes, we can become better developers.
So, I want to convey this message to my fellow developers: Don’t stress too much and turn mistakes into opportunities for growth. 😊

Add a New Comment