[C++-sig] [Boost.Python] exporting GMP numbers to Python

David Abrahams dave at boost-consulting.com
Wed Nov 30 13:18:20 CET 2005


Hans Meine <meine at kogs1.informatik.uni-hamburg.de> writes:

> On Tuesday 29 November 2005 12:20, Jan Langer wrote:
>> I found a working GMP Python wrapper in the GMPY module, but I have
>> simply no idea how use it for my purpose.
>
> Short answer:
> You can either export GMP numbers yourself with Boost::Python, or try to find 
> out how to/from-python conversion is done with the wrapper you found.  In the 
> latter case, export boost::python wrappers returning/accepting 
> boost::python::object's and do the conversion manually.

It's also possible to register custom from_/to_python converters that
will automatically convert the GMP numbers using the wrapper from the
other extension.

http://mail.python.org/pipermail/c++-sig/2002-May/001211.html
http://www.boost.org/libs/python/doc/v2/to_python_converter.html

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list