-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyword arguments and generalized unpacking for C++ API #372
Merged
Commits on Sep 6, 2016
-
Configuration menu - View commit details
-
Copy full SHA for 317524f - Browse repository at this point
Copy the full SHA 317524fView commit details -
Support keyword arguments and generalized unpacking in C++
A Python function can be called with the syntax: ```python foo(a1, a2, *args, ka=1, kb=2, **kwargs) ``` This commit adds support for the equivalent syntax in C++: ```c++ foo(a1, a2, *args, "ka"_a=1, "kb"_a=2, **kwargs) ``` In addition, generalized unpacking is implemented, as per PEP 448, which allows calls with multiple * and ** unpacking: ```python bar(*args1, 99, *args2, 101, **kwargs1, kz=200, **kwargs2) ``` and ```c++ bar(*args1, 99, *args2, 101, **kwargs1, "kz"_a=200, **kwargs2) ```
Configuration menu - View commit details
-
Copy full SHA for c743e1b - Browse repository at this point
Copy the full SHA c743e1bView commit details -
Replicates Python API including keyword arguments.
Configuration menu - View commit details
-
Copy full SHA for 67990d9 - Browse repository at this point
Copy the full SHA 67990d9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 66aa272 - Browse repository at this point
Copy the full SHA 66aa272View commit details -
Configuration menu - View commit details
-
Copy full SHA for 15a112f - Browse repository at this point
Copy the full SHA 15a112fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 625bd48 - Browse repository at this point
Copy the full SHA 625bd48View commit details -
Remove superseded handle::operator() overloads
The variadic handle::operator() offers the same functionality as well as mixed positional, keyword, * and ** arguments. The tests are also superseded by the ones in `test_callbacks`.
Configuration menu - View commit details
-
Copy full SHA for 16db1bf - Browse repository at this point
Copy the full SHA 16db1bfView commit details -
Workaround for py::dict() constructor on MSVC
MSVC fails to compile if the constructor is defined out-of-line. The error states that it cannot deduce the type of the default template parameter which is used for SFINAE.
Configuration menu - View commit details
-
Copy full SHA for 56e86ed - Browse repository at this point
Copy the full SHA 56e86edView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8fe13b8 - Browse repository at this point
Copy the full SHA 8fe13b8View commit details -
Make keyword argument hold a py::object instead of T*
With this change arg_t is no longer a template, but it must remain so for backward compatibility. Thus, a non-template arg_v is introduced, while a dummy template alias arg_t is there to keep old code from breaking. This can be remove in the next major release. The implementation of arg_v also needed to be placed a little earlier in the headers because it's not a template any more and unpacking_collector needs more than a forward declaration.
Configuration menu - View commit details
-
Copy full SHA for 60b2680 - Browse repository at this point
Copy the full SHA 60b2680View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.