I come from a javascript background which I think is the reason I have this question in the first place.
Is there any difference when using self to refer to properties of a class in method definitions.
E.G.
class Foo:
_bar = 15;
def getBar(self):
return self._bar;
vs.
class Foo:
_bar = 15;
def getBar(self):
return _bar;
I guess I could rephrase the question by saying what are the effects of using self when referring to properties inside the class. I.E. What if, for some strange reason, I wanted to return a global _bar variable inside of getBar() instead?