-
Notifications
You must be signed in to change notification settings - Fork 760
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
RFC: py_call!
macro
#4414
Comments
Worth bringing up an old concern by @mejrs in a related topic that We do already have For example, could |
At least the keyword arguments part would be a huge improvement. And If |
Being consistent with the
If a user has a |
I'm generally opposed to macros because they're harder to read and reason about, they tend to not play well with IDE's and the syntax can be surprising/unintuitive. If this can be a function, it should be a function. I haven't looked too much into this, but can we not use the vectorcall apis with FWIW I don't have a problem with the current situation as |
Are you claiming that this is impossible to implement with the current syntax (i.e. no macros)? I believe we should separate discussing potential other syntaxes and supporting vectorcall. vectorcall can be supported with a function as well, and it can even be supported by the existing functions ( |
At the moment, to call a Python function we have
.call(args, kwargs)
,.call1(args)
and.call0()
methods.I have two main concerns with these:
I have been wondering for a while if we should have a
py_call!
macro which mirrors Python syntax and does its best to be efficient.In all of these examples below, I assume
obj
to beBound<'_, T>
:Some special cases might still use the tuple-and-dict convention:
I wonder if we would extend this to method calls:
I suspect that this macro would prefer to be a proc-macro for better error messages etc. The implementation... would probably be a jumble of interesting traits.
I honestly have no idea how easy / hard the implementation would be, but I'm excited that this might create a nice user experience and also be a win for performance!
The text was updated successfully, but these errors were encountered: