[SciPy-user] weave inline returning a multimap to a dict nested within c++
Fri Dec 14 00:59:33 CST 2007
I don't think you can transform a multimap into a dict : a multimap can have
several times the same key, a dict cannot. So first you might need to solve
2007/12/14, Michael ODonnell <firstname.lastname@example.org>:
> I would like to convert a multimap created within c++ to a python
> dictionary in order to return the value. I think I need to do it this way
> because I have a multimap (potential for redundant keys) that needs to be
> sorted. I am using scipy.weave.inline with converters.blitz. If you think
> there is a better way I am open to what ever may work. Although, I prefer to
> stick with weave.inline blitz converter--This is all new and there are a
> lot of components to wrapping c++ in python.
> Anyhow, I tired this:
> py::dict ckmap_freq = map_freq;
> return_val = ckmap_freq;
> And received this error:
> error: conversion from `std::multimap<double, std::string,
> std::less<double>, std::allocator<std::pair<const double, std::string> > >'
> to non-scalar type `py::dict' requested
> I was able to successfully use a similar method but with a vector instead.
> Therefore, it is likely I need to change the syntax.
> thanks for any suggestions and help,
> Never miss a thing. Make Yahoo your homepage.<http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs>
> SciPy-user mailing list
French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user