JuliaPy / JuliaPy/PyCall.jl

Make keyword/positional arguments easier

Ouverte
#701 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Julia
Étoiles
1.5k
Forks
186
Métriques de merge des PR
Aucune PR mergée en 30 j

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?

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par lire le code de gestion des arguments dans src/PyInteract.jl aux lignes indiquées par le lien, puis examinez comment @pydef traite les méthodes. Vérifiez si PyCall prend en charge les macros à l’intérieur de @pydef et comment les arguments positionnels et nommés sont actuellement représentés. L’issue ne définit ni implémentation concrète ni critères d’acceptation ; les conditions d’achèvement attendues doivent donc être clarifiées.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
julia, python
Domaine
api
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.