JuliaPy / JuliaPy/PyCall.jl

not a Python function

Offen
#268 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Julia
Sterne
1.5k
Forks
186
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

sorry if i'm being dumb about this, but functions with multiple input arguments don't seem to be recognized as functions:

```
julia> using PyCall

julia> @pyimport scipy.optimize as so

julia> so.curve_fit((x,m,b)->m*x+b, 1:10, 2:2:20)
ERROR: PyError (:PyObject_Call)
TypeError(' is not a Python function',)
File "/home/arthurb/.julia/v0.4/Conda/deps/usr/lib/python2.7/site-packages/scipy/optimize/minpack.py", line 604, in curve_fit
args, varargs, varkw, defaults = _getargspec(f)
File "/home/arthurb/.julia/v0.4/Conda/deps/usr/lib/python2.7/site-packages/scipy/_lib/_util.py", line 289, in getargspec_no_self
argspec = inspect.getargspec(func)
File "/home/arthurb/.julia/v0.4/Conda/deps/usr/lib/python2.7/inspect.py", line 816, in getargspec
raise TypeError('{!r} is not a Python function'.format(func))

[inlined code] from /home/arthurb/.julia/v0.4/PyCall/src/exception.jl:81
in pycall at /home/arthurb/.julia/v0.4/PyCall/src/PyCall.jl:356
in call at /home/arthurb/.julia/v0.4/PyCall/src/PyCall.jl:372

julia> so.newton(x -> cos(x) - x, 1)
0.7390851332151607
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Reproduce the scipy.optimize.curve_fit example and compare it with the working newton call. Start in PyCall/src/PyCall.jl around pycall and call, using the traceback locations as context. Done means Julia anonymous functions with multiple arguments work with Python code that inspects its callable signature, with regression coverage for this example.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
julia, python
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.