[C++-sig] Boost.Python.function.__signatures__

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Jul 21 04:35:29 CEST 2005


--- Nick Rasmussen <nick at ilm.com> wrote:
> > - I guess currently the docstrings are static. They'd have to become
> dynamic.
> >   This seems to be a bigger project. I think we'd need a volunteer.
> 
> I'm not sure what you mean by dynamic,

It turns out my guess was wrong. Sorry.

I looked some more and here is the result:

http://cci.lbl.gov/~rwgk/boost_python/doc_signatures/function.hpp_2005_07_20_1909_diff
http://cci.lbl.gov/~rwgk/boost_python/doc_signatures/function.hpp_2005_07_20_1909

http://cci.lbl.gov/~rwgk/boost_python/doc_signatures/function.cpp_2005_07_20_1909_diff
http://cci.lbl.gov/~rwgk/boost_python/doc_signatures/function.cpp_2005_07_20_1909

Summary:

- I've removed my __signatures__ method.

- I've patched the getter for __doc__ to *always* append the list of
signatures. E.g.:

>>> help(rational.lcm)

Help on built-in function lcm:

lcm(...)
    C++ signature:
    lcm(int, int) -> int

>>> help(rational.int().numerator)

Help on method numerator:

numerator(...) method of boost_rational_ext.int instance
    C++ signature:
    numerator(boost::rational<int> {lvalue}) -> int


This looks like *the* solution to me. Thanks a lot for your brilliant idea,
Nick!

Personally I don't think we need the facilities to disable appending the
signatures. Are there other opinions?

Dave, could you please briefly review my patch? It is still very simple:
forward class list in function.hpp + list signatures(bool
show_return_type=false) const; declaration; in function.cpp I've move some code
from the body of argument_error() to the new signatures() function and I've
patched the body of function_get_doc() to append the result of signatures().

Cheers,
        Ralf


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Cplusplus-sig mailing list