class Class:
_member = 1
def method(self):
I want to access _member
from within method()
, what is the correct way to do so?
You can use self._member
, if it isn't an attribute of the object (in self.__dict__
) I believe it looks in the classes __dict__
next, which should contain the class attributes.