Skip to content

Syntax to call python functions using pyfn=>ReturnType#484

Open
JobJob wants to merge 3 commits intoJuliaPy:masterfrom
JobJob:pair-call
Open

Syntax to call python functions using pyfn=>ReturnType#484
JobJob wants to merge 3 commits intoJuliaPy:masterfrom
JobJob:pair-call

Conversation

@JobJob
Copy link
Copy Markdown
Contributor

@JobJob JobJob commented Apr 4, 2018

Adds a shorthand (pyfun=>ReturnType)(args...; kws...) for pycall(pyfn, ReturnType, args...; kws...).
Nice to use as pyfun_with_ret = pyfun=>ReturnType

Comment thread test/testmisc.jl Outdated
PyCall.@npyinitialize # see #481

@testset "pair call syntax" begin
np = pyimport("numpy")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use pybuiltin("list") rather than have this test depend on numpy being installed.

@stevengj
Copy link
Copy Markdown
Member

stevengj commented Apr 4, 2018

LGTM.

Comment thread test/testmisc.jl Outdated
@test listpytpl(1.0:10.0) isa Tuple{Vararg{Float64}}
@test typeof(listpytpl(1.0:10.0)) == NTuple{10, Float64}
@test typeof(listpyvec(1.0:10.0)) == Vector{Float64}
# broken with __array_interface__ but not with buffer protocol
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment seems out of place in the revised code.

@JobJob JobJob force-pushed the pair-call branch 2 times, most recently from 5b71678 to 80509b9 Compare April 30, 2018 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants