[C++-sig] Re: Recent changes to FAQ

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Tue May 27 00:37:17 CEST 2003


--- Nicodemus <nicodemus at globalite.com.br> wrote:
> Done, I added the section to the quickdoc source file. Joel, could you 
> regenerate the htmls with your quickdoc, since mine is slighly different 
> than yours? Feedback is highly appreciated!

This looks great! I've corrected a minor typo.

I was thinking that C++ identifiers starting with an underscore are reserved
for the C++ implementation. Wouldn't it be safer to advertise a different
convention? E.g. I'm using _ext (core_ext, io_ext, etc.).

For multi-platform projects it can be problematic to mix Python sources and
compiled binaries in one directory. Fortunately it is quite easy to keep the
compiled extensions and the Python code separate. E.g.:

platform_specific_build_directory/ # binaries only
  sounds_boost/
    __init__.py
    core_ext.pyd
    io_ext.pyd

central_source_code_directory/
  sounds/ # the sources only
    __init__.py
    core.py
    io.py

The user has to add both the central_source_code_directory and the
platform_specific_build_directory to the PYTHONPATH.

In, e.g., core.py:

from sounds_boost.core_ext import *

Another trick that can be handy:

import sounds_boost.core_ext as ext

def point(x=0, y=0):
  return ext.point(x,y)

Ralf


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com




More information about the Cplusplus-sig mailing list