JuliaPy / JuliaPy/PyCall.jl

Make keyword/positional arguments easier

Abierto
#701 4 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Julia
Estrellas
1.5k
Forks
186
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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?

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start by reading the argument-handling code in src/PyInteract.jl at the linked lines and inspect how @pydef processes methods. Check whether PyCall supports macros inside @pydef and how positional and keyword arguments are currently represented. The issue does not define a concrete implementation or acceptance criteria, so the expected completion conditions need clarification.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
julia, python
Área
api
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.