Mailing List Archive

"hello, world" of embedding/extending?
What are the "hello, world" equivalents of embedding and extending
Python (in/with C or C++)?

More generally, where can I find source code didactic examples of
embedding and extending Python? (I write "didactic" because I'm not
quite at the level yet of being able to read real-world,
multiplatform, distribution-grade applications; rather, I'm interested
in examples ranging from the "hello, world" level of complexity to the
level of a full-blown useful application that someone may write for
personal use, i.e. not intended for wide distribution).

Thanks!

KJ, recovering perloholic
"hello, world" of embedding/extending? [ In reply to ]
* kj0@mailcity.com
|
| What are the "hello, world" equivalents of embedding and extending
| Python (in/with C or C++)?

Look here:
<URL: http://www.python.org/doc/current/ext/ext.html >

--Lars M.
"hello, world" of embedding/extending? [ In reply to ]
kj0 <kj0@mailcity.com> wrote:

: What are the "hello, world" equivalents of embedding and extending
: Python (in/with C or C++)?

: More generally, where can I find source code didactic examples of
: embedding and extending Python? (I write "didactic" because I'm not
: quite at the level yet of being able to read real-world,
: multiplatform, distribution-grade applications; rather, I'm interested
: in examples ranging from the "hello, world" level of complexity to the
: level of a full-blown useful application that someone may write for
: personal use, i.e. not intended for wide distribution).

The basic equivalents are in the Demo/embed/ and Demo/extend/ directories
of the source distribution. For full blown extensions just take a look
at any of the C modules in the Modules/ directory.

There is documentation for embedding Python at
http://www.python.org/doc/current/ext/embedding.html and
http://www.python.org/doc/current/api/veryhigh.html
And for extending at
http://www.python.org/doc/current/ext/ext.html and
http://www.python.org/doc/current/api/api.html and
http://starship.python.net/crew/arcege/extwriting/pyext.html

The last webpage (tersely) describes how to make extension types.

-Arcege