Method of restricting attribute access
class GetAttribute():
def __init__(self, name):
self.name = name
def __getattribute__(self, item):
print('sss')
return object.__getattribute__(self, item)
g = GetAttribute('xcq')
print(g.name)
----------results of enforcement----------
sss
xcq
------------------------------------------