I think in this case, PyCharm is doing the right thing. Your code won't run in Python and would get flagged in pylint:
TypeError: unbound method myfunction() must be called with MyClass instance as first argument (got nothing instead)
In PyCharm, the ")" is highlighted, meaning PyCharm is giving you a warning. If you mouse over the ")", you'll see that it says: "Parameter self is unfilled". This is because you are calling "myfunction" without making an instance of the class. Several ways to fix this:
MyClass().myfunction()
def myfunction(self=None)
@staticmethod def bar():
Thus, VS2015 is telling you your Python is fine, when in fact, it won't run.
I have never really noticed because i have been using PyCharm since i started programming. But Arsen is 100% correct. PyCharm doesn't differentiate almost anything while writing execution code.
A line like
some_module.some_function(SomeClass, some_var)
with that many different syntax types in all other "good" IDE's would have distinct visual syntax highlights. In PyCharm that entire line is the same color.
I would even argue this is more important to python that most languages because there is no type info to help. Makes syntax highlighting that much more important.
Matan Is it? I can't for the life of me figure out how to get this to work. I'm using PyCharm 2023.2.5 (Community Edition) I've tried messing around in the settings but despite finding an entry for Class reference and changing it's color I'm not seeing any difference in my code:
I think in this case, PyCharm is doing the right thing. Your code won't run in Python and would get flagged in pylint:
TypeError: unbound method myfunction() must be called with MyClass instance as first argument (got nothing instead)
In PyCharm, the ")" is highlighted, meaning PyCharm is giving you a warning. If you mouse over the ")", you'll see that it says: "Parameter self is unfilled". This is because you are calling "myfunction" without making an instance of the class. Several ways to fix this:
Thus, VS2015 is telling you your Python is fine, when in fact, it won't run.
I understand, thanks! What about color highlighting? Why function and class does not color highlighting after their definition?
I have never really noticed because i have been using PyCharm since i started programming. But Arsen is 100% correct. PyCharm doesn't differentiate almost anything while writing execution code.
A line like
with that many different syntax types in all other "good" IDE's would have distinct visual syntax highlights. In PyCharm that entire line is the same color.
I would even argue this is more important to python that most languages because there is no type info to help. Makes syntax highlighting that much more important.
This is possible by now
Matan Is it? I can't for the life of me figure out how to get this to work. I'm using PyCharm 2023.2.5 (Community Edition) I've tried messing around in the settings but despite finding an entry for Class reference and changing it's color I'm not seeing any difference in my code: