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