[C++-SIG] RE: [META-SIG] Terminating comatose SIGs

Paul F. Dubois dubois1 at llnl.gov
Wed Dec 17 22:38:57 CET 1997


-----Original Message-----
From: Paul Miller <paul at ra.avid.com>
To: Paul F. Dubois <dubois1 at llnl.gov>; Python/C++ SIG <c++-sig at python.org>
Date: Wednesday, December 17, 1997 1:03 PM
Subject: Re: [C++-SIG] RE: [META-SIG] Terminating comatose SIGs


>Paul F. Dubois wrote:
>
>>     Dict a;
>>     a["hi"] = Stryng("ho");
>>     return a;
>
>nice.
>
>>     try {
>>         List a;
>>         Tuple t(args);
>>         for(Tuple::iterator i = t.begin(); i != t.end(); i++) {
>>             a.append(*i);
>>         }
>
>... nicer!
>
>This all looks really good. What I'm even more interested in however is
>easier writing of Python extension classes in C++. I've done a bit of
>work here, as I'm providing a Python scripting interface into an
>object-oriented 3D graphics application I'm leading.

Yes, that is certainly the goal.

>
>FYI - I also did C++ wrappers for tuples and lists. However, I put my
>C++ Python wrappers in "namespace Python" to avoid name collisions with
>other things called "List" or "Tuple". I would recommend the same thing.
>

Well, it is currently "namespace Py", but I'm flexible (:->.

>Another thing I did that may be useful to others is when writing an
>extension function, I made some overloaded "Convert()" methods to call
>when returning common values.
>
>At the end of a function which is supposed to return Py_None for
>example, you just call:
> return Convert();
>
>To return a "C" string, it's
> return Convert("my string");
>
>I didn't get far with making the Py_HEAD stuff and method registration
>any nicer however.
>
In my current implementation, these might be:
return ort(Py_None)   (ort stands for "owned reference to")
and
return ort(Stryng("my string"))

At the moment I have no implicit conversions of basic types into objects.

Anyway, I'm not ready really to put this up as a straw man, so let's defer
discussion of my fragment for now.
>--
>Paul T. Miller                | paul at elastic.avid.com
>Principal Engineer            | Opinions expressed here are my own.
>Avid Technology, Inc. Madison - Graphics and Effects Software Group
>
>_______________
>C++-SIG - SIG for Development of a C++ Binding to Python
>
>send messages to: c++-sig at python.org
>administrivia to: c++-sig-request at python.org
>_______________
>


_______________
C++-SIG - SIG for Development of a C++ Binding to Python

send messages to: c++-sig at python.org
administrivia to: c++-sig-request at python.org
_______________



More information about the Cplusplus-sig mailing list