Python 3.7 Released
Written by Mike James   
Friday, 29 June 2018

I've been using Python 3.7 for weeks so it was a shock to discover that it is a release candidate no more - it's officially the new Python 3.


The road from Python 2 to 3 has been a long and fairly gentle one. If you really couldn't move to Python 3 for one reason or another then you have been well served by the ongoing Python 2 development line. But now enough is enough. Python 3 is mature and this is proved by the welcome, but not major, changes and additions to Python 3.7. This is good because only bored programmers want a language that is developing so fast that the thrill is in trying to keep up. Yes, I suppose I am saying Python is getting old.

So what is new in 3.7?

The most important addition for the average programmer is the addition of data classes. Sometimes you just want to create a class so that it can be used to store data. In other languages you would call such an object a "struct" or a "record type". Java is about to get data classes and Kotlin already has them, for example. Python's data classes give you a decorator way of creating classes that are ready to work with data. You simply add @dataclass in front of a class definition and then list all the data fields you want to use. Each field is a variable name followed by a type annotation. The decorator converts this into a class definition with a suitable __init__ so you can correctly initialize the fields when you create an instance. You can also modify the way the fields are created using the field helper function. What is impressive is that this additional data type has been implemented using nothing but Python.

Talking of type annotations, 3.7 adds forward references and improves the speed of operation. I have mixed feelings about type annotations. They start out being useful, for example when you describe the signature of a function, but quickly become complex and difficult to get right. Not having to deal with generics and variance is one of the advantages of Python - adding them back in, even as an optional feature, isn't an obvious improvement.

Another big feature is the ability to work with attributes defined on modules. You can now use __getattr__ and __dir__ on modules. This logically makes modules look like "bigger" classes, which is more or less what they are.

A smaller feature, in the sense that ns is smaller than ms, is the increased precision of the timing package. You can now use functions in the time module to get nanosecond accuracy returned as an integer.

Now we get to the really small improvements:

  • Dictionary order is now specified as part of the language and iterators work in the order that objects were added.

  • async and await are keywords and if you used a variable with either of these names you deserve the problem that results.

  • The asyncio module has been revamped.

  • New context variables provide thread local storage for asynchronous tasks.

  • A new C API for thread local storage.

Finally there are speedups - calling the standard library is faster; method calls are faster; and startup is faster.

Python 3.7 is out now and there are no good reasons not to use it and many of the new features work with 3.6.


  • Mike James has recently completed work on Programmer's Python: Objects & Attributes, the first volume in his Programmer's Python: Something Completely Different series. In preparing this book he has developed a new passion for Python 3


More Information

Python 3.7.0

Related Articles

Python Development Trends

What Makes Python Special?

Python 3 For Science - A Survey

Jupyter Receives ACM Award

Free Version of PyCharm Python IDE

Getting Started with Python (Draft book extract from Programmer's Python)


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.



Deno Adds Support For Private npm Registries

Deno 1.44 has been released with support for private npm registries and for gRPC connections.

WWII Cipher Machine As Used On D-Day

To celebrate the 80th anniversary of D-Day there's a new addition to the line up of cryptographic machines on Martin Gillow's VirtualColossus website - a 3D simulation of the Hagelin M-209 cipher [ ... ]

More News

C book



or email your comment to:


Last Updated ( Wednesday, 10 October 2018 )