pybind11/docs/advanced
Jason Rhinelander 2686da8350 Add support for positional args with args/kwargs
This commit rewrites the function dispatcher code to support mixing
regular arguments with py::args/py::kwargs arguments.  It also
simplifies the argument loader noticeably as it no longer has to worry
about args/kwargs: all of that is now sorted out in the dispatcher,
which now simply appends a tuple/dict if the function takes
py::args/py::kwargs, then passes all the arguments in a vector.

When the argument loader hit a py::args or py::kwargs, it doesn't do
anything special: it just calls the appropriate type_caster just like it
does for any other argument (thus removing the previous special cases
for args/kwargs).

Switching to passing arguments in a single std::vector instead of a pair
of tuples also makes things simpler, both in the dispatch and the
argument_loader: since this argument list is strictly pybind-internal
(i.e. it never goes to Python) we have no particular reason to use a
Python tuple here.

Some (intentional) restrictions:
- you may not bind a function that has args/kwargs somewhere other than
  the end (this somewhat matches Python, and keeps the dispatch code a
  little cleaner by being able to not worry about where to inject the
  args/kwargs in the argument list).
- If you specify an argument both positionally and via a keyword
  argument, you get a TypeError alerting you to this (as you do in
  Python).
2017-01-31 17:24:41 +01:00
..
cast Automate generation of reference docs with doxygen and breathe (#598) 2017-01-31 16:54:08 +01:00
pycpp Numpy: better compilation errors, long double support (#619) 2017-01-31 17:00:15 +01:00
classes.rst Docs: minor clarifications (#590) 2017-01-13 11:17:29 +01:00
exceptions.rst Reorganize documentation 2016-10-20 15:21:34 +02:00
functions.rst Add support for positional args with args/kwargs 2017-01-31 17:24:41 +01:00
misc.rst Documentation: explicitly call out that the GIL is held (#615) 2017-01-31 17:06:13 +01:00
smart_ptrs.rst Improve custom holder support (#607) 2017-01-31 17:05:44 +01:00