Home > Article > Backend Development > What is the difference between python3.6 and 3.7
Python 3.7 has been released. Currently, the main versions used by Python users should be Python3.6 and Python2.7. So should we switch to Python 3.7?
#First of all, everyone must know that Python 3.7 is an upgrade to Python 3.6. Python official new features for 3.7: (recommended learning: Python video tutorial)
PEP 538, the command line interface of the default interpreter will automatically pass a new environment variable PYTHONCOERCECLOCALE Conversion when there is a feasible UTF-8 based environment (such as C.UTF-8, C.utf8 and UTF-8), depends on whether the environment variable is set and its value.
PEP 539, brings a new C-API for thread-local storage to CPython. PEP 540, adds a new UTF-8 mode, which is enabled by default on POSIX-compliant operating systems and can be changed through the environment variable PYTHONUTF8.
PEP 552, a new source code file verification based on hash value is added for pyc format files.
PEP 553, a new built-in function breakpoint() allows you to enter Python or customize Debugger more conveniently.
PEP 557, a new decorator for Data Classes, reduces the amount of code required when creating classes, and can automatically create methods such as __init__, __repr__, and __eq__.
PEP 560, optimized the typing module and generic types by modifying the core part of the interpreter.
PEP 562, Customized access to module properties.
PEP 563, Optimize Python’s type hints by deferring analysis of comment statements.
PEP 564, a new nanosecond precision method that supports returning int integer form is added to the time module.
PEP 565, once again display Deprecation Warning such as SyntaxWarning and RuntimeWarning at __main__ by default.
PEP 567, a new contextvars module is added to prevent the status of variables from accidentally leaking to other codes in concurrent code through the context manager.
For more details, please go to the python official website.
What we need to pay attention to most is that compared to 3.6, 3.7 is almost completely compatible in syntax, except for the following:
Backwards incompatible syntax changes: async and await are now reserved keywords.
This passage points out that the only incompatibility of 3.7 with 3.6 is that async and await have become reserved keywords in the Python language.
What's the meaning?
The words async and await are just like the words import, for, and while. They are keywords reserved by the system for special purposes.
That is to say, in Python 3.7 you cannot use names such as defined variables and functions
For more Python related technical articles, please visit PythonTutorial column to learn!
The above is the detailed content of What is the difference between python3.6 and 3.7. For more information, please follow other related articles on the PHP Chinese website!