PyCharm lets you define the color of the word "self" just because it's used all over the place and is sort-of ignored when reading. I think it's a nice feature.
Would you want it colored as a keyword?
I think it would be a separate color category of it's own ('self' parameter) or something, since it is expected but is not technically any different from other parameters. You could just color the word itself or if you do some code analysis, you could color whatever word is in that parameter position for that function.Another nice color category would be predefined Python functions like "__init__" and "__str__"
On second thought, it is different from other parameters, as it is provided automatically. So, the code analysis method probably makes way more sense than just coloring the string "self"
We might add support for this in the future. Wing uses the scintilla's python lexer for syntax highlighting, which would support coloring self as a keyword. Other options would be more difficult to implement.
That'd be a fine start for my purposes. I found it pretty nice that "self" was colored in PyCharm.
Copyrights © 2017 All rights reserved