Julia 中的模块别名 [英] Module aliasing in Julia
本文介绍了Julia 中的模块别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 python 中,您可以执行以下操作来使用缩短的模块名称:
In python you can do something like this to let you use a shortened module name:
>>> import tensorflow as tf
从那时起,您可以参考 tf
,而不必到处键入 tensorflow
.
From then on you can refer to tf
, instead of having to type tensorflow
everywhere.
Juila 有可能发生这样的事情吗?
Is something like this possible in Juila?
推荐答案
是的,您可以为模块分配一个新名称.
Yep, you can just assign the module to a new name.
import JSON
const J = JSON
J.print(Dict("Hello, " => "World!"))
我强烈建议使用 const
,否则会有性能损失.(使用 const
,没有性能损失.)
I highly recommend to use the const
because otherwise there will be a performance penalty. (With the const
, there is no performance penalty.)
这篇关于Julia 中的模块别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文