What you see is the name mangling. Names starting with double underscore are treated in a special way to avoid name collision in subclasses.
Basically whenever you have an __some_name attribute in a class, it is renamed automatically to _YourClass__some_name to avoid name collision when inheriting.
You can check this using the dir() function:
>>> class MyClass(object):
... __var = 1
...
>>> dir(MyClass)
['_MyClass__var', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
Note how the list does not contain __var but instead contains _MyClass__var.
The fix is simple: do not use variable names that start with double underscore. If you want to mark a variable as private the convention is to use a single underscore.
I want to stress again that the main purpose of the name mangling is to avoid namespace collisions with subclasses:
>>> class MyClass(object):
... def __init__(self, val):
... self._value = val
...
>>> class MySubclass(object):
... def __init__(self, val):
... super(MyClass, self).__init__(val)
... self._value = val ** 2 #this hides the base class attribute!
...
Note that if the base class is from a third party library, then you can't know which private attributes are defined, since they are not part of the API. Checking with dir gives you only a hint on which name are used, but since they are an implementation detail they can change without notice.
You shouldn't use this to "mark" the attributes as private. The python convention is that attributes starting with a single underscore are private.
On a related topic, also names of the form __something__ with double underscore both at the beginning and the end of the name are treated specially. Some of them implement the special methods and thus you should never use this kind of identifier.