Major New Features of the Python 3.6 Series, Compared to 3.5
Python 3.6 is now officially available. Compared to version 3.5, Python 3.6 comes with many new improvement, characteristics, additional security measures, and tries to make things more useful and simple for developers. Significant improvements in Python 3.6 implementation and standard library have also been made. This article presents a short overview of the Python 3.6 features as compared to 3.5:
Formatted string literals
These are new kind of string literals, also called f-strings. They began with ‘f’ and consist of several replacement fields surrounded by {}. The replacement fields are term which are evaluated at runtime and formatted using format() protocol.
Underscores in numeric literals
For better readability, Python 3.6 comes with the ability to use underscores in numeric literals. Now, single underscores can be used between digits and after any base specified.
Syntax for variable annotations
Python 3.6 comes with standard for type annotations of function parameters. This adds the syntax for annotating different types of variables.
Just as for function annotations, the Python interpreter does not attach any particular meaning to variable annotations and only stores them in the __annotations__ attribute of a class or module.
Asynchronous generators
Python 3.6 improves the support for native coroutines and sync / await syntax introduced in Python 3.5. Now, you can use await and yield in the same function body.
Easy customization of class creation
Python 3.6 comes with customizable subclass creation without using a metaclass. The new__init_subclass__ classmethod will be called on the base class every time a new subclass is defined.
Descriptor Protocol Enhancements
Python 3.6 extends the descriptor protocol to include the new optional __set_name__() method. Every time a new class is created, the new method will be called on all descriptors involved in the definition, offering them with a reference to the class being defined and the name given to the descriptor within the class namespace. If you also want to make career as a Python Professional and want to learn about Python, then join Python Course at CETPA.
CETPA is an ISO 9001:2015 certified training company which provides excellent Python Training in Noida, Lucknow, Dehradun and Roorkee. All of CETPA’s branches are equipped with lab facilities, including latest tools and kit and excellent infrastructure. It has taught many students in Python till date and has placed them in top companies.