New Features in Python 3.9

What Are The New Features In Python 3.9?

Programming

Python has come up with a new version. It has released a beta version of Python 3.9 and will release the full versioning of Python 3.9 by October 2020. Does it look like it’s time to check what’s new in Python 3.9? What improvements and fixes we can expect in the latest version of Python. In this article, we will not detail all the changes and fixes but will try to cover the noteworthy things for the developers.

What is Python?

It is a useful object-oriented programming language built by Guido van Rossum. It was released-up with a focus on the foreground of code readability by using significant whitespaces. Python is said to be a reliable language for creating small to large-size applications.

The Essential Applications of Python include:

  • Game Development
  • Operating Systems
  • Data Science
  • Machine Learning (ML)
  • Language Development
  • Prototyping
  • Small to Enterprise level application development
  • GUI based applications
  • Web serving applications

Developers are always in the hunt of searching for what are new features in Python 3.9? So here we are with the list.

What’s new in Python 3.9?

    • Merging gets better

In Python 3.9, you will see merge (|) and update (|=) operators in the dict-class. So now if you have 2 dictionaries i.e., x and y, you can use these operators to merge and update them

x = {1: “one”, 2: “two”}
y = {3: “three”}
You can use | to merge both the dictionaries.
If the dictionaries have a common key, then the output will capture the value of the second key-pair.
x = {1: “one”, 2: “two”,3: “3”}
y = {3: “three”}
z=x|y
print(z)
[Output]: {1: “one”, 2: “two”, 3: “three”}
For updating the dictionary, you can use (|=)
x = {1: “one”, 2: “three”}
y = {2: “two”}
x|=y
print(x)
[Output]: {1: “one”, 2: “two”}

    • Type Hinting

Python is famous for being dynamically typed; hence, there is no need to mention datatypes in the code. This feature is a little cumbersome, and for static allocation, Type hint comes in use. You can use built-in collection types as generic types. Previously capital types (List or Dict) were required to be imported from typing, but now that is not required.

def greet_all(names: list[str]) -> None:
for name in names:
print(“Hello”, name)

    • New Libraries

One of the best new features in Python 3.9 is a new module, zoneinfo. It is quite probable to bring support for the IANA time zone database to the standard library.
>>> from zoneinfo import ZoneInfo
>>> from datetime import datetime

>>> dt = datetime(2020, 9, 31, 10, tzinfo=ZoneInfo(“India/Delhi”))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
‘PDT

    • graphlib

If you want to perform the topological sorting of graphs, you can add the graphlib module.

Read about the latest trends in web development by experts.

Still Thinking about the Latest Python Version

If you still think, what are the new things in Python 3.9? Here is the list of updated modules you can expect in the latest Python 3.9.Ob3 version.

  • ast
  • asyncio
  • compileall
  • concurrent.futures
  • curses
  • datetime
  • distutils
  • fcntl
  • gc
  • hashlib
  • http
  • implib
  • importlib
  • inspect
  • ipaddress
  • math
  • multiprocessing
  • nntplib
  • os
  • pathlib
  • poplib
  • pprint
  • pydoc
  • random
  • signal
  • smtplib
  • socket
  • time
  • sys
  • tracemalloc
  • typing
  • unicodedata
  • venv
  • xml

New Parser

Python 3.9 uses a new PEG-based parser. Earlier, LL(1) came into use. PEG is comparatively flexible for building new features in the language. However, this flexibility will be seen in Python 3.10 and the versions released later as per official documentation.

What to Expect in Python 3.9?

Python 3.9 production release will be out October month; here is what to expect in Python 3.9.

    • Performance

Every new release of Python has improved its performance. Besides the above is the involvement of vectorcall protocol to enhance the performance. Other built-ins introduced are range, tuple, set, frozenset, to speed up the execution.

    • Strings and Dictionary

Manipulation of data types is easy with Python. Version 3.9 extends this with new features for strings and dictionaries.

    • Improved Python Internals

Python developers have been consistent in improving Python’s internals. The foremost thing is the redesigned way of how modules interact with the import machinery. The new landing mechanism is written in C. Secondly; it has a stable internal ABI for CPython. Earlier released versions of Python failed to be ABI-incompatible, which required extension modules to be recompiled for every new release. In the latest version, the modules in the standard library use the stable ABI.

Key Takeaways

Python is flexible and can operate on various platforms like Raspberry Pi, Windows, Mac OS, etc. Python is here to stay. Be it, Information Technology or Finance sector, a web application framework helps organizations reap maximum benefits from operational investments.

By

I am Marketing Manager at Digitalize Trends. My role is to research & ideate on trending topics & need to write the niche content as per industry norms. To help & provide relevant information to the community on trending technologies.

Tweet Share Share