Make keyword/positional arguments easier
- Dominant language
- Julia
- Stars
- 1.5k
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
In Python, most arguments can be specified either positionally or as keywords. This is important when you're defining functions that have to conform to an existing interface (and the users of that interface use both positional and keyword forms of the function).
```python
def myfunc(foo, bar, spam=None, *, eggs=123):
return foo, bar, spam, eggs
myfunc(1, 2)
myfunc(foo=1, bar=2)
myfunc(1, 2, eggs=3)
# etc.
```
Currently, this is a pain in PyCall: [look at this monster!](https://github.com/JuliaPy/PyInteract.jl/blob/118f5ae219eab562691b65415d8c221e41612734/src/PyInteract.jl#L35-L49)
I tried to write a macro that does that automagically but PyCall doesn't seem to like macros inside `@pydef`s. Is there any way to make this easier/can we make one?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.