class Investor:
def __init__(self, profile):
self.profile = profile
def __getitem__(self, item):
return self.profile[item]
It is ok to access Investor profile by simply Investor['name'],
But it comes to an error when I use get() Investor.get('name')
Raised: AttributeError: 'Investor' object has no attribute 'get'
I know I can fix it by adding a get() method to Investor Class, but is it a right way to do? or are there any other special method __get__ or whatever?
dictor inherit formdictwithout overriding anything.