What is the output of the following code ?
class MyClass: def __init__(self): self.__a = 1 obj = MyClass() print(obj._MyClass__a)
1
AttributeError
None
"" (blank)
The attribute names starts with 2 underscores are pseudo private attributes and they eventually converted to _ClassName__attrname.
So here __a will be converted to _MyClass__a and can be accessed using obj
Comment here: