|Python 3.7 Adds Data Handling Classes|
|Written by Kay Ewbank|
|Friday, 09 February 2018|
The first of four beta previews of Python 3.7 is now available, with a new DataClasses module, an easier way to enter the debugger, and a UTF-8 mode that uses UTF-8 encoding by default.
The scheduled date for the general release of Python 3.7 is June 2018, and this beta is feature complete for that final version.
The first change to Python is the addition of the dataclasses module. This is designed to provide an alternative to the way Python developers had, until now, to use boilerplate code to instantiate classes with a lot of initializers. The new module provides a class decorator that inspects the class’s variable annotations, and based on what is present, adds methods including init, repre and eq to the lass. It is similar to
Another improvement in the 3.7 is a new C API for thread-local storage in CPython. There was already a C API for thread-local storage support; but the existing Thread Local Storage (TLS) API has used
There's also a new development mode command line option and Pythondevmode environment variable to enable CPython’s “development mode”. This introduces additional runtime checks that are too expensive to be enabled by default. The options that are activated by using the -x dev mode include a debug mode for the asynchronous operations module that offers more detailed logging and exception handling for asynchronous operations; and debug hooks for memory allocators.
Another improvement is a new UTF-8 mode that makes Python ignore the locale and use UTF-8 encoding. Python has supported UTF-8 handling of strings for many years, but if the locale is sett to ASCII, this would until now override the UTF-8.
There are a number of other improvements and some performance improvements including faster method calls, more efficient optimization of source code constants, and faster matching in regular expressions where the match is case insensitive.
or email your comment to: email@example.com