c/c++ extensions and help()

Philip Austin paustin at eos.ubc.ca
Sun Jul 31 13:26:57 EDT 2005


Robert Kern <rkern at ucsd.edu> writes:

> Lenny G. wrote:
>> Is there a way to make a c/c++ extension have a useful method
>> signature?  Right now, help(myCFunc) shows up like:
>> myCFunc(...)
>>   description of myCFunc
>> I'd like to be able to see:
>> myCFunc(myArg1, myArg2)
>>   description of myCFunc
>> Is this currently possible?
>
> There really isn't a way to let the inspect module know about
> extension function arguments. Just put it in the docstring.
>

The next release of boost.python should do this automatically:

(http://mail.python.org/pipermail/c++-sig/2005-July/009243.html)


>>> 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


Regards, Phil



More information about the Python-list mailing list