[CentralOH] Data Members / Properties - 2 questions

Mark Erbaugh mark at microenh.com
Sun Feb 14 07:13:12 CET 2010


On Feb 13, 2010, at 10:41 PM, Nick Albright wrote:

> Hey Mark!  
> 
> I think you can use getattr() and setattr() instead of __dict__ and it'll catch the property.  
> 
> I hope that helps! (And I hope my memory is right ;)
>  -Nick


Nick,

getattr() / setattr() did the trick. However, they aren't methods of the class so I had to call them:

getattr(object, 'field')

setattr(object, 'field', data)

Is that what you were thinking, or were you thinking they were bound methods of the class:

object.getattr('field')?

Getting this working saved me from having to do a major re-work of some of the code.

Thanks,
Mark


More information about the CentralOH mailing list