[C++-sig] Re: function::argument_error / overloads & docstrings

David Abrahams dave at boost-consulting.com
Thu Nov 6 05:24:46 CET 2003

Nikolay Mladenov <nickm at sitius.com> writes:

>> Help on method set:
>> set(...) unbound keywords.Foo method
>>     set(struct Foo self, int a=0, double b=0.0, class
>> _STL::basic_string<char,struct std::char_traits<char>,class
>> _STL::allocator<char> > n="")
>>         Sets all the fields of self
>> (END)
>> >>>
> I now think that this is too intrusive and there should be a way
> to specify whether or not the signature will be attached to the
> docstring.
> May be like that:
>  def ("f", &f, "f's docstring")
>  def ("g", &g, "%s\n\t g's docstring")
> .....
>>>> print f.__doc__
> f's docstring
>>>> print g.__doc__
> g() -> None
> 	g's docstring

Help has other means to generate signature information, which doesn't
intrude on the docstring.  At least, there is a means to tell help
about the names of function parameters.  You could stick their names
in if supplied, and use their C++ types otherwise.  I'd look more
closely at the attributes used by help to produce its output.

Dave Abrahams
Boost Consulting

More information about the Cplusplus-sig mailing list