Re: [C++-sig] shared_ptr object identity

2010-08-16 Thread Ralf W. Grosse-Kunstleve
Hi Earl, > > Do I understand correctly that you want to use the object essentially like > > a dictionary, just with obj.key instead of obj["key"]? > > I consider this bad practice, since it isn't obvious to readers of your > > code. > > Yes, you make a good point here, and it has made me question

Re: [C++-sig] shared_ptr object identity

2010-08-16 Thread Erlend Cleveland
> Do I understand correctly that you want to use the object essentially like > a dictionary, just with obj.key instead of obj["key"]? > I consider this bad practice, since it isn't obvious to readers of your > code. Yes, you make a good point here, and it has made me question the use cases that I

Re: [C++-sig] shared_ptr object identity

2010-08-15 Thread Ralf W. Grosse-Kunstleve
Hi Earl, > So I would wrap member functions returning the shared_ptr, and store a > persistent reference to the python object, returning its shared_ptr > instead? Yes. > > - Add all data attributes to the C++ object (and use .def_readonly() or > > .def_readwrite()). > > Then the state of the o

Re: [C++-sig] shared_ptr object identity

2010-08-15 Thread Erlend Cleveland
>> I've been bashing my head against a wall for the past couple of days > >> trying to figure this out. It's frustrating because it seems like it >> should be such a simple thing. > > I cannot be so simple if you think of the C++ side as being unaware of > the Python layer. Each time the C++ functi

Re: [C++-sig] shared_ptr object identity

2010-08-15 Thread Ralf W. Grosse-Kunstleve
Hi Erland, > I've been bashing my head against a wall for the past couple of days > trying to figure this out. It's frustrating because it seems like it > should be such a simple thing. I cannot be so simple if you think of the C++ side as being unaware of the Python layer. Each time the C++ fun