Experimenting with static methods in Python
I was writing a class to construct CURL requests in Python. I decided to experiment with making one of the methods static. To do this, simply place a “@staticmethod” decorator before the method declaration.
The static method can then be called with:
Ultimately, I decided not to make this a static class, but no doubt I’ll make use of this Python feature when it comes to constants and other constructs that it makes sense to use statically.
Comments