Getattr Getattr Setattr
Table of Contents

getattr(obj, 'foo') is exactly the same thing as obj.foo.

in getattr(self, attribute), you should fetch unavailable attribute (from dict or class.dict) from your extra storage by getattr(self.storage, attribute)
in setattr(self, attribute), you can directly access self.dict. for those attributes not available. you can call setattr(self.storage, attribute)

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License