[C++-sig] Re: C arrays solution

David Abrahams dave at boost-consulting.com
Wed Oct 15 17:38:03 CEST 2003


Niall Douglas wrote:

> On 14 Oct 2003 at 7:42, David Abrahams wrote:
> 
> 
>>>The key here is that MyList knows nothing of python and offers no
>>>more than a C array of pointers, something which up until now was
>>>hard to wrap without lots of munge code.
>>
>>I'm not sure what "munge code" means.  The behavior you show above is
>>almost trivial to achieve using Boost.Python, without anything I
>>consider to be "munge code".
> 
> 
> I'm getting that picture from Raoul. However if it's so easy, why is 
> Raoul developing indexing_suite?

To handle reference and lifetime issues which are mostly not relevant to 
you because your container holds strings, which are immutable in Python.

>>Question 1:  when you modify b above, do you expect it to affect a?
> 
> 
> Yes.
> 
> 
>>Question 2:  do you expect b to be an actual Python list,
>>             i.e. type(b) == list ??
> 
> 
> Not really as it can't be extended in length. So while it looks like 
> a list and acts like a list, it's not a list.

In that case, I suggest you just make a getData function which returns 
self.  That'll make your life *way* simpler.






More information about the Cplusplus-sig mailing list