Python 3.13.0a0 What’s Coming?
Exciting Features Await
Python 3.13.0a0 is currently in development and includes a number of new features and improvements. In this blog post, we’ll look at some of the new Python 3.13.0a0 features and provide some sample code to get you started.
The most recent version is 3.11.4, and 3.12 is in early preview. You can better understand Python 3.13.0a0 by reading these articles about Python 3.11.4 and Python 3.12.
New Features
There are no new modules yet, but there are some improved modules; they are array
, io
, pathlib
, traceback
, typing
.
array
:'w'
type code is available to be used for Unicode strings.io
:close()
method of theio.IOBase
finalizer now logs errors withsys.unraisablehook
.pathlib
: Added changes topathlib.PurePath.match()
,pathlib.Path.glob()
andrglob()
.traceback
The show_group parameter was added totraceback.TracebackException.format_exception_only()
.typing
:typing.get_protocol_members()
was added to the set of members defining atyping.Protocol
.typing.is_protocol()
was added to check whether a class is atyping.Protocol
.
Performance Optimizations
From PEP 594:
Deprecated Features
- Deprecation of
wave.Wave_read
andwave.Wave_write
methods - Deprecation of keyword arguments in creating
typing.NamedTuple
classes - Deprecation of functional syntax usage in creating
typing.NamedTuple
andtyping.TypedDict
classes - Deprecation of the array’s
'u'
format code. - Deprecation of
ctypes.SetPointerType()
andctypes.ARRAY()
functions
Removed Features
- Removal of
telnetlib
module. - Removal of
2to3
program andlib2to3
module. - Removal of namespaces
typing.io
andtyping.re
. - Removal of
webbrowser
MacOSX class - Removal of support for using
pathlib.Path
object as context managers - Removal of
configparser.LegacyINterpolation
class. - Removal of
turtle.RowTurtle.settiltangle()
method. - Removal of certain unittest functions
- Removal of
cgi
andcgitb
modules - Removal of various modules and packages like
sndhdr
,pipes
,ossaudiodev
,mailcap
,spwd
,nntplib
,nis
,xdrlib
,msilib
,crypt
,uu
,aifc
,audioop
,chunk
,imghdr
,unittest.TestProgram.usageExit()
,tkinter.tix
, trashcan macros,locale.resetlocale()
,logging.Logger.warn()
,urllib.request.urlopen()
parameters,webbrowser.MacOSXOSAScript._name
attribute,re.template
function, andre.TEMPLATE
flag
C API Changes
Deprecated:
Deprecated old Python initialization functions such as
PySys_ResetWarnOptions()
PY_NAME_GetExecPrefix()
Py_GetPath()
Py_GetPrefix()
Py_GetProgramFullPath()
Py_GetProgramName()
Py_GetPythonHome()
- Deprecated the
Py_ImportModuleNoBlock()
function, scheduled for removal in Python 3.15. Removed:
Removed
Removed functions deprecated in Python 3.9, such as PyEval_CallObject()
, PyEval_CallObjectWithKeywords()
, PyEval_CallFunction()
, PyEval_CallMethod()
, andPyEval_CFunction_Call()
.
The following old functions to configure the Python initialization, deprecated in Python 3.11, have been removed:
PySys_AddWarnOptionUnicode()
: UsePyConfig.warnoptions
instead.PySys_AddWarnOption()
: UsePyConfig.warnoptions
instead.PySys_AddXOption()
: UsePyConfig.xoptions
instead.PySys_HasWarnOptions()
: UsePyConfig.xoptions
instead.PySys_SetArgvEx()
: SetPyConfig.argv
instead.PySys_SetArgv()
: SetPyConfig.argv
instead.PySys_SetPath()
: SetPyConfig.module_search_paths
instead.Py_SetPath()
: SetPyConfig.module_search_paths
instead.Py_SetProgramName()
: SetPyConfig.program_name
instead.Py_SetPythonHome()
: SetPyConfig.home
instead.Py_SetStandardStreamEncoding()
: SetPyConfig.stdio_encoding
instead._Py_SetProgramFullPath()
: SetPyConfig.executable
instead.
Resources
3.13.0a0 Documentation (n.d.) 3.13.0a0 Documentation. https://docs.python.org/3.13/
What’s New in Python 3.13 (n.d.) Python Documentation. https://docs.python.org/3/whatsnew/3.13.html