Since the listing in your question is not 100% clear, I’ve decided to explain it with a simple example. It also includes some things like __something variables you did not mention in your list.
class Test:
a = None
b = None
def __init__(self, a):
print self.a
self.a = a
self._x = 123
self.__y = 123
b = 'meow'
At the beginning, a and b are only variables defined for the class itself – accessible via Test.a and Test.b and not specific to any instance.
When creating an instance of that class (which results in __init__ being executed):
print self.adoesn’t find an instance variable and thus returns the class variableself.a = a: a new instance variableais created. This shadows the class variable soself.awill now reference the instance variable; to access the class variable you now have to useTest.a- The assignment to
self._xcreates a new instance variable. It’s considered “not part of the public API” (aka protected) but technically it has no different behaviour. - The assignment to
self.__ycreates a new instance variable named_Test__y, i.e. its name is mangled so unless you use the mangled name it cannot be accessed from outside the class. This could be used for “private” variables. - The assignment to
bcreates a local variable. It is not available from anywhere but the__init__function as it’s not saved in the instance, class or global scope.