
I am working through the Python Institute’s free courses in preparation for the certifications they offer. These cover material in a logical, structured fashion. I needed this review since my Python skills were acquired ad hoc over 5 years and, as a result, there are some small gaps in my knowledge of certain fundamentals.
Today I read a statement (repeated from earlier in the course) where it states:
“a method is obliged to have at least one parameter“
Python Institute – Python Essentials – Part 2, 6.1.4.1 OOP: Methods
This seems incorrect to me. When the @staticmethod decorator is prefixed to a method declaration, the required self parameter is no longer necessary. I’ve used this quite a few times in my code. However, the trade-off is that when this decorator is used, the ability to access instance variables is completely negated. A nice but brief article is written about this and the @classmethod decorator on StackAbuse.
Mistakes such as these do not dissuade me from continuing the coursework in the Python Institute. It is still effective in providing me with pertinent knowledge.
You must be logged in to post a comment.