Python 3.9 now available – SD Times

python-logo.png

The latest version of Python is now available. Python 3.9 introduces a number of new features, such as dictionary merge and update operators, string methods for removing prefixes, and more.

Merge (|) and update (|=) operators have been added to the dictionary class. These additions complement existing methods of merging dictionaries, dict.update and {**d1, **d2}.

Python 3.9 also adds new string methods for removing prefixes and suffixes. The new methods include str.removeprefix(prefix) and str.removesuffix(suffix). The team has also added corresponding bytes, bytearray, and collections.UserString methods. 

Developers will also now be able to use built-in collection types instead of generic types when doing type annotation.

A new parser based on PEG is available as of this release. The old parser was based on LL(1), and while there isn’t a performance improvement with the new parser, PEG is more flexible than LL(1) when it comes to designing new language features. In Python 3.10, the old parser will be deleted, along with any functionality that depends on it. 

There are a number of other changes to the language in 3.9. More information can be found in the release notes here.  

Credit: Source link