JuliaPy / JuliaPy/PyCall.jl

Make keyword/positional arguments easier

Aperta
#701 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
1.5k
Fork
186
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.