[SciPy-user] weave inline returning a multimap to a dict nested within c++

Matthieu Brucher matthieu.brucher@gmail....
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
this problem.


2007/12/14, Michael ODonnell <odonnems@yahoo.com>:
> 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,
> Michael
> ------------------------------
> 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
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user

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...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20071214/d6c623b2/attachment.html 

More information about the SciPy-user mailing list