Skip to content

Docstring for dispatched methods  #107

Closed
@henry2004y

Description

@henry2004y

I have a case where I want to dispatch on an imported Python function, for example,

using PythonCall

mpl = pyimport("matplotlib")
mpl.use("qt5agg")

plt = pyimport("matplotlib.pyplot")

# function doc issue

"What should I do?"
function plt.plot(a::String)
   println("hello multi-dispatch!")
   plt.plot(1:10)
end

plt.plot("Haha!")

which returns

julia> include("test_pythoncall.jl")
ERROR: LoadError: MethodError: no method matching doc!(::Module, ::Py, ::Base.Docs.DocStr, ::Type{Tuple{String}})
Closest candidates are:
  doc!(::Module, ::Base.Docs.Binding, ::Base.Docs.DocStr, ::Any) at /home/local/hongyang/bin/julia-1.7.2/share/julia/base/docs/Docs.jl:226
  doc!(::Module, ::Base.Docs.Binding, ::Base.Docs.DocStr) at /home/local/hongyang/bin/julia-1.7.2/share/julia/base/docs/Docs.jl:226
Stacktrace:
 [1] top-level scope
   @ .../test_pythoncall.jl:10

Do you have an idea how to fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions