[CentralOH] Data Members / Properties - 2 questions

Nick Albright nick.albright at gmail.com
Sun Feb 14 07:52:20 CET 2010


Oh No, I was definitely thinking of the first way.  Kartic, definitely be
curious how the code turns out!
  -Nick

On Sun, Feb 14, 2010 at 1:13 AM, Mark Erbaugh <mark at microenh.com> wrote:

>
> 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




-- 
Please note that as of 1/20 I no longer have a land phone line, only my
cell.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/mailman/private/centraloh/attachments/20100214/28a40ef4/attachment.htm>


More information about the CentralOH mailing list