Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-06-15 19:53:07


----- Original Message -----
From: "John Max Skaller" <skaller_at_[hidden]>

> David Abrahams wrote:
>
> > C++ functions which are exposed to Python get an argument conversion
layer
> > which is based on the argument types (using template type deduction).
So, if
> > there is a conversion from the passed Python type to the C++ argument
type,
> > the function call succeeds with that conversion. If you want your C++
> > function to see a "raw" python type, there are several options:
> >
> > 1. Use a PyObject* argument. Its type conversion is the identity
> > 2. Use a boost::python::ref, which does the reference-counting part for
you
> > 3. Use a specific python type wrapper (e.g. boost::python::tuple) from
> > boost/python/objects.hpp.
>
> I see. Thanks! I'd never considered something
> other that (1). So I guess there is a predefined mapping
> from Python types to C++ types?

For some types, yes. The user can add additional mappings, and of course
classes that the user exposes to Python also get automatically mapped.

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk