[python-win32] Best practices for writing extensions in C
Mark Hammond
mhammond@skippinet.com.au
Sun, 3 Nov 2002 11:09:54 +1100
> 1. I've written it all by hand so far, but is there any benefit to
> using SWIG ? I've exposed all the bits I need, and I don't intend to
> use any other scripting language to access the API. What other reasons
> are there for using SWIG ?
For me, SWIG is a speed-of-implementation and ease-of-maint tool, rather
than a cross-language tool. If it is done, it is done <wink>.
> 2. What conventions to people use to document the parameters that
> python has to supply, and can I make these visible to an end user ?
The best bet is probably Python style docstrings, where the first line is a
brief synopsis of the signature. IDLE and Pythonwin (and presumably others)
will use this first line of a doc string if there is no better info.
The autoduck tool I use for win32all may also work, but is only visible to
the end user via the help system.
> 3. What is the best way to package up the extension for distribution ?
> Do people use PPM for Win32 extensions ?
To who? If to Python developers you expect to already have Python
installed, distutils. If not, check out distutils or Gordon's installer
tool - you get a single EXE, then installing that should be easy any way you
like <wink>
Mark.