Three days ago, the team behind Python announced the release of Python 3.9.0a1, which is the first out of the six planned alpha releases of Python 3.9. The final stable version of Python 3.9 is slated to release in May 2020. An alpha release indicates that developers can start testing the new features and check for bug fixes but are not recommended to use it in production.
Last month, the previous stable version, Python 3.8 was released with features like walrus operator, positional-only parameters support for Vectorcall.
Let’s look at some of the raw features that you can be expected in the upcoming Python 3.9 version.
Some improvements introduced in Python 3.9.0a1
- The __import__() function which is invoked by the import statement will now raise ImportError instead of ValueError. In the previous versions, the latter used to occur when a relative import went past its top-level package.
- Starting from Python 3.9.0a1, the absolute path of the script filename will be specified on the command line: the __file__ attribute of the __main__ module. The sys.argv and sys.path will become an absolute path rather than a relative path. Also, the traceback will now display the absolute path for __main__ module frames in this case.
- The encoding and errors arguments in the debug build and development mode will now be checked in the string encoding and decoding operations.
- ast: It is added in the indent option to dump() and produces a multi-line indented output.
- asyncio: It can now use coroutine which is a generalized form of subroutines. Subroutines enter and exit at only two different points, while coroutines can be entered, exited, and resumed at many points. Moreover, asyncio.run() is updated to use the new coroutine.
- New functions like curses.get_escdelay(), curses.set_escdelay(), curses.get_tabsize(), and curses.set_tabsize() and constants F_OFD_GETLK, F_OFD_SETLK and F_OFD_SETLKW is included in Python 3.9.0a1.
Few Python users have already started testing the Python 3.9.0a1 release.
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">last night I uploaded <a href="https://twitter.com/hashtag/python?src=hash&ref_src=twsrc%5Etfw">#python</a> 3.9.0 alpha 1 builds for deadsnakes (<a href="https://twitter.com/hashtag/ubuntu?src=hash&ref_src=twsrc%5Etfw">#ubuntu</a> ppa) -- highly recommend checking it out if you want a sneak peek at some of the stuff that'll be in python3.9! <a href="https://t.co/ttZfgsgobS">https://t.co/ttZfgsgobS</a></p>— Anthony Sottile (@codewithanthony) <a href="https://twitter.com/codewithanthony/status/1197559895744110592?ref_src=twsrc%5Etfw">November 21, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
The next alpha release for Python 3.9 is scheduled for 16th December 2019.
To know more about Python 3.9.0a1, check out the official documentation.