-
Notifications
You must be signed in to change notification settings - Fork 118
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
support for kwargs calls #17
Comments
I like this idea, but it's not obvious to me that this is the correct approach. There are three issues that I have with it:
without annotations, Pythonizing this code would still have to be done by hand (either directly in the CPython, or with a Python wrapper function). That all said, I'm not sure that annotations are the correct approach either: I feel like the intention is that someone should be able to run |
you're correct: I wasn't very clear. my intention was always to have (with the same definition than in the issue): import pkg
pkg.Hello("1","2") # OK
pkg.Hello(arg1="1", arg2="2") # OK
pkg.Hello(arg1="1") # ERROR: missing an argument
pkg.Hello(arg2="2") # ERROR: missing an argument all the arguments would always have to be passed to the function or method, but they could also be named. and you're also right that the not-clearly stated goal of that said, it is still just an idea (with not even a dev-branch in my local git repo), nothing's written in stone yet. type Point struct{x, y int}
func Distance(p Point) float64 { ... }
Distance(Point{1, 2}) // currently permitted
Distance(Point{x: 1, y: 2}) // currently permitted
Distance({1, 2}) // would be permitted if struct type were inferred
Distance({x: 1, y: 2}) // would be permitted if struct type were inferred I am not sure what would be the best pythonization of such a mechanism... (I'll cross-ref with the new proposal once it appears on go/issues) |
for old version, closing |
gopy
should perhaps generate code with support for kwargs.consider:
should be callable from
python
like so:The text was updated successfully, but these errors were encountered: