Static method with %r as first argument


Used when a static method has self or cls as first argument.


Explanation needed from a more experienced Python programmer. :-) But this is one rookie's understanding of it.

Because it is customary for instance or class methods to take self or cls, respectively, as their first arguments, a method that uses either of these names but is found to be a static method may have been defined incorrectly.

Even if the method being flagged is truly meant to be a static method, you should be mindful of the convention above and choose names other than self or cls for arguments. Otherwise you risk confusing other Python programmers looking at your code.

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License