Positional/keyword-only arguments #17
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Python allows keyword-only arguments and positional-only arguments. Will the compiler also deal with these constructs? This is not an urgent feature for us, but just wondering.
I don't think we would support this as we have no plan to support varargs.
Close this first unless someone wants further discussion about this...
Why not? This seems easy enough to do (assuming the RustPython parser supports it), and it does not depend on varargs.
Sorry forgot to check it carefully, it seems that keyword-only arguments require varargs support as they are placed after varargs, but positional-only arguments do not require varargs, right?
No.
Correct.
OK we can support it, but in the end we would just convert them into normal function calls, and we would treat them as position-only for function pointers (I don't want keywords to leak into the type signature). Is this OK?
What's the problem with keywords into the type signature?
I would rather not support special arguments at all if the behavior with function pointers is inconsistent. Alternatively, we can also not support function pointers as long as we can do things like iterate on a list of objects and call a method on each (as discussed previously).
This way, basically each function would be of its own type due to differences in parameter naming. Supporting this would not be hard, but it is weird when combined with function pointers.
We can already do this by using tuples. I do think function pointer would be useful, e.g. lambdas, and it is easier to use function pointers than to wrap the function into a class with a method that only contains 1 function call...
Yes as mentioned, this is not about varargs. This feature is not critical and I neither have strong opinions about the implementation if implemented. I think it would just be nice if the syntax would be accepted if it is not too much work.