A new version of Python was released on October 5, 2020. This technical article will go over some of the highlights of what is new in Python 3.9 that are interesting if you are an Engineer, Scientist or Quant using Python. For all details of what changed, see the Python 3.9 Release Notes.

Before diving into Python 3.9, it is interesting to see the release history of Python and how often it has changed.

Python VersionRelease DateDays
3.9.05 October 2020356
3.8.014 October 2019474
3.7.027 June 2018551
3.6.023 December 2016467
3.5.013 September 2015546
3.4.016 March 2014533
3.3.029 September 2012587
3.2.020 February 2011603
3.1.027 June 2009206
3.0.03 December 2008

It can be overwhelming to keep up to date with every aspect of what changed between Python 3.8 and Python 3.9. This is VersionBay’s list of main changes that is worthwhile knowing if you are passionate about Python.

  • New Features:
    • union operator for dict
  • New Module
    • zoneinfo – now has support for IANA time zone database to the standard library
  • Module Improvements:
    • ipaddress – supports scope_id

New union operator

There is a new union operator in Python for dict. It was introduced as not many people knew about the alternative and now this common task is much more readable. Here is an example:

# Add Union Operator in Python 3.9
d1 = {"Name": "dict", "Python": 3.9}
d2 = {"Name": "dict", "Operator":"|"}

# in python 3.9
d3 = d1 | d2

# before python 3.9
d4 = {**d1, **d2}

For more information please see: PEP 584.


In Python 3.9 there is a new module which is particularly useful: zoneinfo. Anyone who has used Python and works with dates on a regular basis at a certain moment will stumble across that it is important to know timezones. It is great to see Python now supports IANA time zone database. Here is a small example of how to use it:

from zoneinfo import ZoneInfo
from datetime import datetime, timedelta

# Daylight saving time
dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
# expected result: 2020-10-31 12:00:00-07:00


# Standard time
dt += timedelta(days=7)
# expected result: 2020-11-07 12:00:00-08:00


Please note for the code above to work you will need to install:

pip install tzdata

For more information please see: PEP 615.


In Python 3.9 the ipaddress module got updated and improved by supporting the scope_id. This is not a huge improvement but it made it to our top list as in general the better support for ipaddress the more useful python is. The scope_id is defined as by RFC 4007, this property identifies the particular zone of the address’s scope that the address belongs to, as a string. One can define an ipaddress like this:


This article explains the beauty of this. That being said, at the highest level it is becoming more common to use the zone_id or scope_id and seeing core support from Python put a smile on our face.

For more information please see: RFC 4291 

If you found this article interesting and would like to learn more about Python Contact Us.