-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Positional only argument support with Python keywords #3695
Comments
This eases migrating to inspect.signature with Py3 code to be able to support positional-only arguments (#3695). Less conditional code simplifies the logic many other ways as well.
inspect.getfullargspec doesn't support positional-only arguments (#3695). This commit doesn't yet enable that support.
Changes: - Add `positional_only` attribute. - Rename `positional` to `positional_or_named`. - Rename other attributes for consistency. - Enhance ArgInfo to handle positional-only args. Actual positional-only argument support is still to-do. See #3695 for more details.
Adding this support allowed removing ArgumentSpec.supports_named and in the end more code was removed than added.
This is now done otherwise but documentation is still missing. |
I decided to implement this so that if a keyword is implemented like def example(posonly, /, normal=None):
print(posonly, normal) and called like
the
|
Docs are written and this issue can be considered done. A nice benefit of adding positional-only arguments was that it allowed removing |
This eases migrating to inspect.signature with Py3 code to be able to support positional-only arguments (robotframework#3695). Less conditional code simplifies the logic many other ways as well.
inspect.getfullargspec doesn't support positional-only arguments (robotframework#3695). This commit doesn't yet enable that support.
Changes: - Add `positional_only` attribute. - Rename `positional` to `positional_or_named`. - Rename other attributes for consistency. - Enhance ArgInfo to handle positional-only args. Actual positional-only argument support is still to-do. See robotframework#3695 for more details.
Adding this support allowed removing ArgumentSpec.supports_named and in the end more code was removed than added.
Python 3.8 added support for positional-only arguments. They have some nice usages with Python code but I doubt they are that important with RF libraries. Anyway, we should support them or at least make sure things don't break strangely. I also believe we should add the support already in RF 4.0 because changes affect our model objects that may be exposed via Libdoc APIs and changes later would cause backwards compatibility problems.
This issue covers supporting positional-only arguments only with Python based keywords. Separate issue can be submitted about supporting them with dynamic libraries that often are implemented with Python and could benefit from the support as well. We could also support them with user keywords if someone comes up with valid use cases.
The text was updated successfully, but these errors were encountered: