[C++-sig] pyste and C++ namespaces

Daniel Holth dholth at fastmail.fm
Tue Jan 27 19:06:18 CET 2004


On Tue, 2004-01-27 at 01:51, Jeff Holle wrote:
> In further pyste experimenting, I put my C++ code in a namespace.
> 
> First surprise was that I needed to decorate my class name in the 
> *.pyste file with its housed namespace.
> Doing this allowed pyste to run successfully, but.
> 
> Second surprise that the generated python interface class now contains a 
> "wrapper" class.  Is this necessary?  The class is easily accessible by 
> opening the namespace, or not, depending on the C++ choice.

Could it be that pyste is adding a wrapper so that you can inherit from
your C++ class within python, and the virtual method calls will transfer
appropriately?  There is a final option somewhere that prevents this.

As far as missing features, I thought the most-missing feature was
specifying docstrings in the .pyste.  Here's a patch to add the feature.

This patch allows any keyword arguments to Function() and Class(); if
you add a doc="the documentation" argument, it adds the docstring to the
wrapper.

Unfortunately, Boost.Python functions don't appear to inherit from
Python functions (yet?) so help() only prints class documentation - but
you can type help(yourmodule.functionname) to read your function
documentation.

- dwh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: docstring.patch
Type: text/x-patch
Size: 5109 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20040127/ed1099c1/attachment.bin>


More information about the Cplusplus-sig mailing list