If I run this in Python
class Boo(object):
def __init__(self, x):
self._x = x
self.__bingo = 3
self._info = {'x': x, 'y':42}
def __dir__(self):
return ['x']
@property
def x(self):
return self._x
@property
def z(self):
return self._x+1
def __getattr__(self, key):
return self._info[key]
b = Boo(44)
b.__dict__.keys()
then it prints
['_info', '_Boo__bingo', '_x']
Why does __bingo
get renamed? Are double-underscore attributes reserved?