[C++-sig] extracting a numpy.int32 type

Nathan Huesken boost-python at lonely-star.org
Thu Dec 10 16:17:03 CET 2009


Hi,

Thanks for the reply.

But still something, I would like to understand:

If I want to convert numpy.float64 -> double, it works without problems.
If I want to convert numpy.int32 -> int, I seem to need to register a
new converte ...

Why is this?

Thanks!
Nathan

On Wed, Dec 09, 2009 at 04:29:19PM +0100, Ger van Diepen wrote:
> Hi Nathan,
> 
> We have converters written at the end of 2006. We never needed to convert them to the more powerful newer versions of Boost-Python as they still build fine. So they might look outdated.
> 
> They can convert scalars, sequences, dicts, and numpy arrays of many types, also all numeric numpy types. So it can convert, say, an element of a numpy int32 array to a C++ float scalar. Vice-versa a C++ numeric value is always converted to a regular Python numeric type.
> They work well on both 32bit and 64bit platforms.
> 
> If you want to see more you can find the code at pyrap.googlecode.com.
> 
> Cheers,
> Ger
> 
> 


More information about the Cplusplus-sig mailing list