Current location - Music Encyclopedia - Chinese History - Why is python3 so different from python2?
Why is python3 so different from python2?
The difference between python2 and python3

If you are a beginner or have been exposed to other programming languages before, you may not know that you will encounter a rather headache when you first start learning python: version problem! ! Do you want to learn python2 or python3? This is very tangled!

Search will find that python3 and python2 are incompatible and very different. Which version should I learn? Let's analyze it for everyone:

In fact, python is one of the most commonly used softwares on linux, but at present, most versions of linux still use python2, and there are many programs that rely on python2 on linux, so it will take several years for Python3 to replace python2 as the mainstream.

Python3 was originally designed to improve Python without the burden of code compatibility, but personally, the improvement is not drastic enough, some bugs have not been completely improved, and many wart missed the opportunity of improvement, resulting in less syntax incompatibility than originally thought.

After years of exploration, people can directly write 2/3 compatible codes in most cases, and there are also six compatible layers available.

So it's not a problem to learn Python2 or Python3 first, or both.

At present, Python3 is not considered in most practical applications for the time being, and sometimes you should pay attention to writing 2/3 compatible code. When writing new code based on Python2, consider the possibility of migrating to Python3 in the future.

not have

When learning Python2 or Python3, we need to pay attention to the differences on the other side: fortunately, these differences are easy to master, and there is only one unicode encoding.

It has troubled many people (and it is also the main obstacle to the transplantation of many web-related libraries. With the re-support of U'' in 3.3, the situation has been greatly improved).

Python3, python2 or python3 depends on the specific situation.

So I suggest:

1. If you need to use python to learn python in an enterprise, it depends on the python version that the enterprise applies for learning;

2. If you want a more mature solution, the least bugs and the most stable application, then use Python 2;;

If you are a college student, I suggest you study python3. Maybe python will be mainstream by the time you graduate.