On 12/26/14 2:12 AM, ilias wrote:
It's not a bug, it's as designed. Boost.python tries function overloads
in reverse registration order and picks the first one that works, in the
sense that all the arguments convert.
Is that behavior specified somewhere in the documentation?
I'm not sure it is. It ought to be. It is mentioned on the TODO page
where it discusses changing this behavior.
http://www.boost.org/doc/libs/1_57_0/libs/python/todo.html#best-match-overload-resolution
If the behavior was changed it would surely break existing code. The
current behavior is at least straightforward to reason about, and we've
been able to get most cases to work (even tricky ones) by carefully
arranging the registration order.
For the rare case where a single order doesn't work, we simply write a
lightweight wrapper that takes boost::python::object args and do the
introspection and dispatch manually. Sometimes we have this generic
overload as a "fallback" that we register first, letting boost.python
handle the simple cases when it can.
Alex
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig