-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Keyword-only args for Python functions are poorly implemented #524
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
Comments
wow. what does that do ? I don't even know where to start looking that up. |
Py3 feature: http://legacy.python.org/dev/peps/pep-3102/ |
This is the "bare star" argument passing style. It's not poorly implemented, it's just not implemented :) (On the compiler side it is, but not in the runtime side.) |
Actually, while the compiler emits the correct byte code, it doesn't collect enough information about number of keyword-only args to pass to the runtime. I'm working on this. |
Well, in first approximation, kw-only args can be treated exactly as kw args. Of course, it would be nice if compiler set corresponding flag for a func arg. But handling it can be left for later, even #466 would be of higher priority. |
It's not a flag, but rather the compiler needs to tell how many args are positional and how many are kw only. Then pretty much the existing code that handles kw args will work. |
Implements 'def f(*, a)' and 'def f(*a, b)', but not default keyword-only args, eg 'def f(*, a=1)'. Partially addresses issue #524.
I again would like to sound a proposal that as first step, kw-only args should be treated just the same as normal args with a default value provided. In other words,
should be treated as:
Due to this simple handling not implemented, I have to apply patch like above manually to CPython stdlib. |
I would rather fix it properly :) |
Then friendly ping from urllib.request.urlopen():
|
We might now be able to close this issue :) |
Great, thanks much! Seems to work based on one test ;-). |
I knew I shouldn't even try them, especially taking into account that I dislike all these novelties. But then CPy stdlib was parsed by pure accident - they seem to start using it heavily.
Each of cases below is a failure:
The text was updated successfully, but these errors were encountered: