如何检查对象定义在哪个模块中?

DVN*_*old 4 julia

如果我有一个对象(比如一个方法、一个结构或一个类型,用 导入using),我怎样才能获得它最初定义的模块?

ffe*_*tte 7

您可以使用该parentmodule功能。例如:

julia> parentmodule(rand)
Base

julia> parentmodule(versioninfo)
InteractiveUtils
Run Code Online (Sandbox Code Playgroud)