Is it better to learn Python 2. X or python3. X? This is also a problem many beginners will encounter. Our answer is Python 3.x. In order to help you eliminate doubts, here unified tell you the reason.

  1. Python3.1, IO module is implemented using Python language, 5~10 times faster than 2.x

  2. Python3.1, str.format() supports automatic numbering:

  1. Python 3.1, 64-bit int is 27% to 55% faster.

  2. Python 3.2, a major update to the global interpreter lock (GIL), significantly improves the way Python handles multithreading.

  3. Python3.3, which rewrites the decimal module in C, is between 12 times faster (database operations) and 120 times faster (high-density calculations) than before.

  4. Python3.3, UTF-8 encoding is 2~4 times faster, utF-16 encoding is up to 10 times faster.

  5. Python3.4, optimized for pickle modules, performance improved several times.

  6. Python 3.4, the Python interpreter starts 30% faster.

  7. Python3.4, added tracemalloc module. A debugging tool for tracking and counting Python memory allocations.

  8. Python3.4, added enum module to provide enumeration. A lot of people complain that Python doesn’t have enumerations, and now it does, albeit in a modular way.

  9. Python 3.5, which makes asynchrony less tricky, makes the async and await keywords part of the language syntax.

  10. Python3.5, new syntax: Type Hints and typing modules. Easy to read code.

  1. Python3.5, UTF-8, UTF-16, and Latin-1 codes can be decoded 2 to 4 times faster than before.

  2. Python3.5 added the.hex() function to convert bytes directly to hexadecimal.

  1. Python3.5, new os.scandir() function, faster, less memory traversal folder. Three to five times faster on POSIX and seven to 20 times faster on Windows. Os.walk () is also currently using this function.

  2. Python3.6, using C language to implement asyncio.Future class and asyncio.Task class, asyncio program performance is 25%~30% faster.

  3. Python3.6, the glob() and iglob() functions of the Glob module now use the os.scandir() function. Three to six times faster.

  4. The glob() function of the Python3.6, pathlib.Path module now uses the os.scandir() function. One and a half to four times faster.

  5. Python3.6, new secrets module to generate strong random numbers. Previously, the Random module could only generate pseudo-random numbers. It is officially recommended not to use the Random module when dealing with security issues.

  6. Python3.7, the time module has six new functions that can access nanoseconds, such as time.time_ns(), time.perf_counter_ns(), and so on.

So that’s the end of our article, if you’d like to see our Python tutorial today, please stay tuned and give us a thumbs up/check out if it was helpful. If you have any questions, please leave them in the comments below and we’ll be patient to answer them!


20 reasons why you should use Python3.x instead of Python2.x

Python Dict.com Is more than a dictatorial model