There are several different implementations of Python, and because they are actively developed, versions are released regularly. Currently, there are four complete, powerful and stable mainstream Python implementations:
1. CPython is a regular old version of Python, and it is also what we usually call Python. It is both a compiler and an interpreter, with its own set of standard packages and modules all written in standard C language. This version works out of the box for all popular current platforms. Most third-party Python packages and libraries are compatible with this version.
2.PyPy is a faster implementation of Python that uses a JIT compiler to make code run faster than the CPython implementation - sometimes providing speedups of up to 10x-100x. PyPy is also more memory efficient and supports greenlets and stackless for high parallelism and concurrency.
3.Jython is a Python implementation of the Java platform. It supports Java Virtual Machine (JVM) and is suitable for any version of Java (version 7 or above is best). By using Jython, you can write code using all types of Java libraries, packages, and frameworks. It works best when you understand more about Java syntax and OOP principles widely used in Java such as classes, objects, and interfaces.
4.IronPython is a Python implementation of the popular Microsoft .NET framework, also known as the Common Language Runtime (CLR). You can use all Microsoft CLR libraries and frameworks in IronPython, and even if you don't actually need to write code in C#, it helps you understand more about C#'s syntax and constructs to use IronPython effectively.
It is first recommended that you use the default Python version, which is the CPython implementation , and only if you are really interested in interfacing with other languages (such as C# and Java) and need to be in the code base Only when using them can you try other versions.
There is a lot of debate about which version of Python to use. The best approach is that you consider the problem you are solving and the complete software ecosystem you need to work with, starting from libraries, dependencies and architecture through implementation and deployment - but also consider reusing existing legacy code bases.
As mentioned earlier, the two main Python versions are the 2.x series and the 3.x series. They are very similar, but there were several backward-incompatible changes in the 3.x version, which caused a huge migration between people using 2.x and people using 3.x. Most legacy code and most Python packages on PyPI were developed in Python 2.7. Library ported to Python 3.x. Here are some of the changes in the 3.x series:
By default, all text strings are Unicode.
Print and exec are now functions, no longer statements.
range() returns a memory-efficient iterable instead of a list.
Modified the style of the class.
Library and name changes based on conventions and type conflicts.
There is no absolute answer to the question of which version to choose. It purely depends on the problem you are trying to solve, the existing code and infrastructure you have, how the code will be maintained in the future and all the necessary dependencies.
The above is the detailed content of Which version of python is popular now?. For more information, please follow other related articles on the PHP Chinese website!