编程时使用 Jython
我最近开始学习 Python,并遇到了术语 Jython。 从谷歌搜索结果来看,我由此得出结论,这确实是一个非常重要的术语。 使用 Jython 编程/编码是怎样的体验?
I recently started learning Python and came accross the term Jython.
From the Google search results, I thereby concluded that it is indeed a very important term.
What is the experience programming/coding using Jython?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Jython 只是运行在 JVM(Java 虚拟机)上的 Python 解释器的实现。
因此,Jython 中的编码与 Python 中的编码基本相同;具有访问 Java 库的优势。
阅读:Jython 常见问题解答、为什么选择 Jython?
Jython is just an implementation of the Python interpreter that runs on the JVM (Java Virtual Machine).
So coding in Jython is the basically same as coding in Python; with the advantage of having access to Java libraries.
Read: Jython FAQ, Why Jython?
这不仅仅是访问 Java 库的优势。它还能够在 Java 虚拟机的所有支持和优化(即 JIT 编译)上运行。
Jython 对于编写 Java 应用程序脚本也非常有用。
IronPython 是 .NET CLI 的类似方法
It's not just about the advantage of having access to the Java libraries. It's also being able to run on Java VM's with all their support and optimizations (i.e. JIT compilation).
Jython is also very usefull for scripting Java applications.
IronPython is a similar approach for the .NET CLI
我给您的建议是:忘掉 Jython 和 IronPython。除了初学者和他们的开发人员之外没有人使用它们。至于 Jython,它比 Python(又名 CPython)慢得多,健壮性和可靠性也较差。它没有 Python 那样的大量“电池”;此外,线程、进程和其他较低级别的内部工作方式是不同的,从而导致微妙且难以调试的错误。
My recommendation to you: Forget about Jython and IronPython. Nobody uses them except the beginners and their developers. As for Jython, it's much slower, less robust, and less reliable than Python (aka CPython). It doesn't have the significant number of "batteries" that come Python; moreover, threading, process, and other lower-level inner-workings are different, resulting in subtle and hard-to-debug bugs.