Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Wed Jul 20 02:17:26 CEST 2005
Often I'd like to quickly find out the signatures of C++ functions wrapped with
Boost.Python. Usually I use one of two approaches: 1. look in the wrapper
sources, 2. call the function with no or bogus arguments to provoke a
Python 2.4.1 (#1, Apr 7 2005, 10:15:30)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-113)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from boost import rational
Traceback (most recent call last):
File "<stdin>", line 1, in ?
Boost.Python.ArgumentError: Python argument types in
did not match C++ signature:
Both options are not very elegant. I'd really like something more direct and
easier to explain. This lead me to the idea of implementing
Here you'll find the diffs for function.hpp and function.cpp, and also the
patched versions of both.
It works like this:
>>> print boost_rational_ext.lcm.__signatures__
I.e. __signatures__ returns a list of strings with the signatures formatted as
in the traceback. Is this a good direction to take?
I know it needs more work (similar patch for member functions (?), tests on all
platforms, updated docs). I'll do this if I get positive feedback.
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the Cplusplus-sig