----- Original Message ----- > From: "Stefan Seefeld" <ste...@seefeld.name> > To: "Development of Python/C++ integration" <cplusplus-sig@python.org> > Sent: Tuesday, January 21, 2014 10:45:52 AM > Subject: Re: [C++-sig] create a python object from scratch in boost.python? > > On 01/21/2014 10:37 AM, Gary Oberbrunner wrote: > > So now it returns a python list of python dicts. All I want now is > > to > > override __getattr__ on each ppinfo dict so it returns the dict > > value > > as the attribute value, so in python I can reference > > effect_list[i].name instead of effect_list[i]['name']. Or any > > alternative way to get the same effect. Is that possible? > There are many ways to do that elegantly in Python. For example: > > class Effect: > def __init__(self, mydict): > self.__dict__.update(mydict)
I like the idea of using self.__dict__. If that's accessible from C++, then I suppose I could have an empty C++ class, export that as a simple container, and dynamically add attributes to it by manipulating its __dict__. Does that seem possible? -- Gary Oberbrunner _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig