Python 3.5 Released: New modules, optimized for performance, and more friendly to developers

Source: Internet
Author: User
Tags locale virtual environment virtualenv

Python 3.5 Released: New modules, optimized for performance, and more friendly to developers

Python 3.5.0 officially released on September 13, compared with 3.4, what are the expectations of new features?


PEP441, optimizing Python support for ZIP compression packages. Starting with version 2.6, Python supports a file or zip-like compression package as a script, which is useful for applications that need to be published as a file and complex to be managed in a modular way. But this feature is seldom known, and one of the reasons is that it was not well publicized at the time, only mentioned in what's new, not written in the document; The second reason is that Windows does not provide the appropriate Python extension (like. py) for this form of file (. zip). So this time the release of this feature is republished, and, define. Pyz and. Pyzw as extensions for "Python zip apps" and "under Windows Python zip Apps", and provides a simple administrative tool.


PEP448, the unpacking operation is more convenient. * As an iterative unpacking operator, * * As the dictionary's unpacking operator. Data structures such as list,tuple can be dispersed by unpacking operations, for example, *range (4), 4 results (0, 1, 2, 3, 4).


The pep461,% operator supports formatting of byte and byte arrays.


PEP465, new matrix multiplication operator ' @ '. A @ b indicates matrix A multiply matrix B, also supports a @=b.


PEP471, added Os.scandir (), to quickly traverse the directory.


PEP475, which provides support for automatic retries when a system call is interrupted.


Pep479,stopiteration exceptions are handled inside the generator. Now if the generator raise a stopiteration, it will be replaced with RuntimeError. Because this feature is not forward compatible, it was originally published in __future__ form.


PEP484, added new standard for typing module, type annotation. Supported by Def greeting (NAME:STR), str: This form declares a function to annotate the input and output ground data types.


PEP485, added Math.isclose (), to determine approximate equality.


PEP486 to optimize the support for virtualenv on the Windows platform. In Windows Python if virtualenv or multiple versions are installed, the path of the interpreter needs to be configured to specify an interpreter to execute, but it does not differentiate between a virtual environment or a system environment, and if the command line such as Pip is used, the system environment is affected. This pep enables the system to feel the existence of a "virtual environment", and it says that if you do not specifically specify an interpreter, running the Python command in Windows will affect the active virtualenv, and if not, call the default Python.


PEP488, no longer use the. pyo file name. extension. PYC, if you add an optimization parameter, the bytecode file is generated in the same directory. PYC will make the optimized version, and the optimization level will be saved in the file.


PEP489, optimizes the loading of built-in modules and extension modules.


PEP492, supports asynchronous collaboration of ASYNC/AWAIT syntax. Python has been optimized for asynchronous, with Awaitable object, co-function, asynchronous iteration, and asynchronous context manager added.


Optimization of other CPython


When the Lc_type locale is a POSIX locale (C locale), Sys.stdin and sys.stdout use the Surrogateescape error handler, and the strict error handler is no longer used.


Standard library Important optimization


Collections. Ordereddict is rewritten in C with a 4-100-fold increase in speed.


SSL module supports Memory BIO


Added the Os.scandir () function.


Functools.lru_cache () is rewritten with C, which greatly improves performance.


The new function Subprocessrun () makes running subprocesses faster.


Traceback module optimization, higher performance, more friendly to developers.


Security optimization


The standard library disables SSLv3.


HTTP cookies that resolve more rigorously to prevent potential injection attacks.


Windows optimization


Replace the MSI with the new Windows Installer.


Windows build and extension modules now use Microsoft Visual C + + 14.0.


Feedback


Redsymbol says Python3 is getting better, he has used more than 3:2 three years, and is deeply in love with Python3. Sometimes having to use 2.7, you will feel that from the fifth generation tool back to the second generation. Some people retort that is "from the second generation back to the Five Dynasties" bar, Python3 no parameter list self-solution (parameter tuple unpacking by itself), used to feel very unfriendly. ORF response: I spent more than 7 years Python do not know what this thing is, nor seen in the code, remove the difficult feature is a big step forward, if you can not accept, I am sorry. Py3 is awesome. (There is a lot of discussion about this feature in the thread)


"You guys are doing this typing module, excited!. RICW mentioned that this module solves Python's biggest weakness, and Python will become more and more professional later.


Ceronman said it was his favorite 3. x version, typing comment module, async/await, unpacking a wide range of applications, these features are very good, unfortunately PEP0498 did not catch up with this version, look forward to 3.6 (the original post is a long discussion of this feature).


If all things are compatible with PY3, the world is perfect:).


Python 3.5 Released: New modules, optimized for performance, and more friendly to developers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.