Python 3.5 Released
Written by Kay Ewbank   
Wednesday, 16 September 2015

Python 3.5 has been released with support for coroutines and a new matrix multiplication operator.  .

pythonbanner

 

The latest version of Python has new library modules, and the standard library has been improved. Security has also been enhanced, and there are a number of new syntax features.

The addition of coroutines with async-await means you can write asynchronous code. The await expression can be used to suspend coroutine execution until the result is available, making it behave as though it was sequential. This seems to be the route that all languages are taking to async these days.

The matrix multiplication operator @ has been added to make code where you are multiplying matrices look cleaner and more standard. However, while the @ infix operator has been added, none of the built in Python types implement it, so you have to define __matmul__(), __rmatmul__(), and __imatmul__() for regular, reflected, and in-place matrix multiplication.

There are two new library modules in the new version – typing and zipapps.

The typing module adds support for type hints. According to the What's New documentation about type hints:

“experience has shown that the majority of function annotation uses were to provide type hints to function parameters and return values. It became evident that it would be beneficial for Python users, if the standard library included the base definitions and tools for type annotations.”

Type hinting seems to be the way that weakly typed languages are making up for their lack of strong typing. 

The new zipapp module provides an API and command line tool for creating executable Python Zip Applications. Zip applications have been around since Python 2.6 but aren’t widely known about. The new module means you can bundle an app by putting all the files, including a __main__.py file, into a directory myapp and running two commands:

$ python -m zipapp myapp

$ python myapp.pyz

New built-in features add % formatting to bytes and bytearray; and a hex method has been added to bytes, bytearray, and memoryview. Memoryview now supports tuple indexing (including multi-dimensional), and generators have a new gi_yieldfrom attribute, which returns the object being iterated by yield from expressions.

CPython implementation has been improved, so that .pyo files are no longer used and have been replaced by a more flexible scheme; and builtin and extension modules are now initialized in a multi-phase process, which is similar to how Python modules are loaded.

The standard library has been significantly improved. Collections.OrderedDict is now implemented in C, which makes it 4 to 100 times faster; the ssl module now has support for Memory BIO, which decouples SSL protocol handling from network IO; and functools.lru_cache() has been mostly reimplemented in C, yielding much better performance.

Security improvements mean that SSLv3 is now disabled throughout the standard library, though you can choose to enable it. HTTP cookie parsing is now stricter to protect against potential injection attacks.  

If you are still using Python 2 then it is more than time to move on to 3. 

 

 

python3

Banner


Go At Highest Rank Ever in TIOBE Index
20/11/2024

Go is currently in 7th place in the TIOBE Index for November 2024. Not only is this is the highest position it has ever had, it's percentage rating is almost equal to its all-time-high. Will Go contin [ ... ]



Amazon Adds AWS Lambda Code Editing Tool
04/11/2024

Amazon has added a new code editing option for AWS Lambda in the AWS console based on the Code-OSS, Visual Studio Code Open Source code editor.


More News

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Tuesday, 29 September 2015 )