Make keyword/positional arguments easier
- Vorherrschende Sprache
- Julia
- Sterne
- 1.5k
- Forks
- 186
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.