/ Published in: Python
                    
                                        
Placing these inside a PyObjC class lets you access PyObjC instance variables starting with '_' without extra work while still allowing access to standard Python instance variables.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
def __getattr__(self, name):
if name[0] == '_':
return objc.getInstanceVariable(self, name)
else:
return self.__dict__[name]
def __setattr__(self, name, value):
if name[0] == '_':
return objc.setInstanceVariable(self, name, value, 1)
else:
self.__dict__[name] = value
return value
Comments
 Subscribe to comments
                    Subscribe to comments
                
                