[C++-sig] multiply defined to_python_converter

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Wed Dec 11 03:05:04 CET 2002

--- David Abrahams <dave at boost-consulting.com> wrote:
> > How do I work around this problem of "multiply defined
> > to_python_converter"?
> Hmm.  I'm not sure what the best answer is.  Does Python have a
> warning mechanism?


> Maybe it would be best to maks such multiple
> definitions trigger a Python warning instead of a hard error.

I am not sure if this is a viable solution. For example there are two plausible
alternatives for std::vector<> to_python conversions:

- to a Python list or tuple

- implied by class_<std::vector<> >

I am using both alternatives, depending on the value type. Others will have
different requirements and make different choices. This will lead to

Ways out?

Boost.Python could simply occupy the most prominent ecological niches by
default, then everybody has to adhere to that. Conflicts will be the exception.
Unfortunately a fully fledged std::vector<> wrapper is fairly heavy-weight. But
there is a similar wrapper in the scitbx (flex_wrapper.h; see Boost.Python FAQ)
if someone wants to take on this chore.

Another idea would be a conversion registry with "context" or "namespaces". Any
function could be defined in a certain context with associated conversions. But
I am afraid David will need a BIG grant to implement such a beast.


More information about the Cplusplus-sig mailing list