Hi all

I'm fairly new to Boost.Python and currently I'm looking for a convenient way 
of adding docstrings to overloaded operators, e.g:

class A;
class B
A operator+(A const&, A const&);
B operator+(B const&, B const&);

BOOST_PYTHON_MODULE(foo) {
bp::class_<A>("A")
  .def(self + self)  //< How to add docstring here?
}

I know I could also use:

A (*A_add_op)(A const&, A const&) = operator+;
bp::class_<A>("A")
  .def("__add__", A_add_op, "Add two A objects")

or a direct cast, but honestly, I don't look forward to all that typing, and it 
is so much harder to read than the first option.

Thanks for the help

Michael

Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to