在Python中,您可以使用 as 关键字导入具有所需名称的模块 . 朱莉娅有同样的东西吗?
as
显然你可以做到
import moduleWithReallyLongName M = moduleWithReallyLongName
有没有更好的办法?
import moduleWithReallyLongName const M = moduleWithReallyLongName
请注意const的用法 . 根据经验,Julia中的任何全局变量都应该是类型稳定的,否则您将观察到性能降低 .
另一种选择是包 ImportMacros.jl (https://github.com/fredrikekre/ImportMacros.jl)
ImportMacros.jl
using ImportMacros @import moduleWithReallyLongName as M
1 回答
请注意const的用法 . 根据经验,Julia中的任何全局变量都应该是类型稳定的,否则您将观察到性能降低 .
另一种选择是包
ImportMacros.jl
(https://github.com/fredrikekre/ImportMacros.jl)