For example, I have an instance:
class Job(object):
def __init__(self, name, client=None):
self.name = name
self.client = client
job = Job('test')
job.client # I don't want the client to be accessed outside, as it's only as an internal attribute.
from searching in the community, I didn't find a solution I want.
Although I knew that setting client as __client
could achieve this, I don't want to change the attribute name.
I guess some magic functions are able to achieve this, like __dict__
or __getattr__
. can someone show me some idea? very appreciate.