You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I've been able to determine one needs to specify *args for **kwargs to work in an instance method. The documentation for py_argparse indicates that this is a bug. It allows parameter to have either syntax but doesn't specify that one is required for the other to work. Python also allows it (e.g. def f(**kwargs): is a valid signature).
// Doesn't work :(// [Error] no rules expected the token `{`py_class!(class Example |py| {
def _replace(&self, **kwargs) -> PyResult<NoArgs> {Ok(NoArgs)}});
// Workaround that works :)py_class!(class Example |py| {
def _replace(&self, *args, **kwargs) -> PyResult<NoArgs> {Ok(NoArgs)}});
If it significantly affects the complexity of the implementation then this restriction is fine and the workaround definitely works for my use case. Feel free to regard this as a pure documentation bug if you want.
The text was updated successfully, but these errors were encountered:
I hope it can be fixed. Having to manually implement the error response for receiving the wrong number of positional arguments from Python seems un-Rusty at best.
As far as I've been able to determine one needs to specify
*args
for**kwargs
to work in an instance method. The documentation forpy_argparse
indicates that this is a bug. It allows parameter to have either syntax but doesn't specify that one is required for the other to work. Python also allows it (e.g.def f(**kwargs):
is a valid signature).If it significantly affects the complexity of the implementation then this restriction is fine and the workaround definitely works for my use case. Feel free to regard this as a pure documentation bug if you want.
The text was updated successfully, but these errors were encountered: