JuliaPy / JuliaPy/PythonCall.jl

[Enhancement] Allow `Python: <class 'module'>` as argument to `pyimport`

未关闭
#590 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Julia
星标
1.1k
派生
86
平均合并
1 天 22 小时
30 天内合并 PR
3

描述

With these methods:

```julia
pyimport((m, k)::Pair{Py}) = pyimport(string(m.__name__) => k)
pyimport((m, ks)::Pair{Py,<:Tuple}) = pyimport(string(m.__name__) => ks)
```
you can do something like
```julia
amodule = pyimport("amodule")
afunc = pyimport(amodule.submodule1.submodule2, "afunc")
```
You can use TAB completion at the REPL to get the submodules. This is more convenient than finding and typing the strings.

I don't know how robust `string(m.__name__)` is.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。