Menu

#165 italicize cls for static methods

open
nobody
None
5
2006-08-23
2006-08-23
No

For "normal" instance methods "self" refers to the
object in question. For static methods (class methods),
the parameter "self" should be changed to "cls":

class MyClass(object):
@classmethod
def some_method(cls):
cls.do_something()

"cls" should be displayed in italics, just like "self"
in the usual case, and omitted from the parameter list
when auto-completing.

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.