4242 module.
4343 (Contributed by P.Y. Developer in :issue:`12345`.)
4444
45- This saves the maintainer the effort of going through the Mercurial log
45+ This saves the maintainer the effort of going through the git log
4646 when researching a change.
4747
4848 This article explains the new features in Python 3.10, compared to 3.9.
@@ -143,7 +143,7 @@ For instance, consider the following code (notice the unclosed '{'):
143143 38 : 4 , 39 : 4 , 45 : 5 , 46 : 5 , 47 : 5 , 48 : 5 , 49 : 5 , 54 : 6 ,
144144 some_other_code = foo()
145145
146- previous versions of the interpreter reported confusing places as the location of
146+ Previous versions of the interpreter reported confusing places as the location of
147147the syntax error:
148148
149149.. code- block:: python
@@ -153,7 +153,7 @@ the syntax error:
153153 ^
154154 SyntaxError : invalid syntax
155155
156- but in Python3 .10 a more informative error is emitted:
156+ but in Python 3 .10 a more informative error is emitted:
157157
158158.. code- block:: python
159159
@@ -171,7 +171,7 @@ These improvements are inspired by previous work in the PyPy interpreter.
171171(Contributed by Pablo Galindo in :issue:`42864 ` and Batuhan Taskaya in
172172:issue:`40176 ` .)
173173
174- :exc:`SyntaxError ` exceptions raised by the intepreter will now highlight the
174+ :exc:`SyntaxError ` exceptions raised by the interpreter will now highlight the
175175full error range of the expression that consistutes the syntax error itself,
176176instead of just where the problem is detected. In this way, instead of displaying
177177(before Python 3.10 ):
@@ -194,7 +194,7 @@ now Python 3.10 will display the exception as:
194194 ^^^^^^^^^^^^^^^^^^^^
195195 SyntaxError : Generator expression must be parenthesized
196196
197- This improvement has been contributed by Pablo Galindo in :issue:`43914 ` .
197+ This improvement was contributed by Pablo Galindo in :issue:`43914 ` .
198198
199199A considerable amount of new specialized messages for :exc:`SyntaxError ` exceptions
200200have been incorporated. Some of the most notable ones:
@@ -408,7 +408,7 @@ in C, Java or JavaScript (and many other languages). Often the switch statement
408408is used for comparison of an object / expression with case statements containing
409409literals.
410410
411- More powerful examples of pattern matching can be found in languages, such as
411+ More powerful examples of pattern matching can be found in languages such as
412412Scala and Elixir. With structural pattern matching, the approach is " declarative" and
413413explicitly states the conditions (the patterns) for data to match.
414414
@@ -649,7 +649,7 @@ platforms, omitting ``encoding`` option when opening UTF-8 files
649649 with open (" data.json" ) as f:
650650 data = json.load(f)
651651
652- To find this type of bug, optional `` EncodingWarning`` is added.
652+ To find this type of bug, an optional `` EncodingWarning`` is added.
653653It is emitted when :data:`sys.flags.warn_default_encoding < sys.flags> `
654654is true and locale- specific default encoding is used.
655655
@@ -824,7 +824,7 @@ Improved Modules
824824asyncio
825825------ -
826826
827- Added missing :meth:`~ asyncio.events.AbstractEventLoop.connect_accepted_socket`
827+ Add missing :meth:`~ asyncio.events.AbstractEventLoop.connect_accepted_socket`
828828method.
829829(Contributed by Alex Grönholm in :issue:`41332 ` .)
830830
@@ -904,7 +904,7 @@ they are provided by the underlying curses library.
904904dataclasses
905905---------- -
906906
907- Added `` slots`` parameter in :func:`dataclasses.dataclass` decorator.
907+ Add `` slots`` parameter in :func:`dataclasses.dataclass` decorator.
908908(Contributed by Yurii Karabas in :issue:`42269 ` )
909909
910910.. _distutils- deprecated:
@@ -953,7 +953,7 @@ Add :class:`enum.StrEnum` for enums where all members are strings.
953953fileinput
954954-------- -
955955
956- Added * encoding* and * errors* parameters in :func:`fileinput.input` and
956+ Add * encoding* and * errors* parameters in :func:`fileinput.input` and
957957:class :`fileinput.FileInput` .
958958(Contributed by Inada Naoki in :issue:`43712 ` .)
959959
@@ -964,13 +964,13 @@ when *mode* is "r" and file is compressed, like uncompressed files.
964964gc
965965--
966966
967- Added audit hooks for :func:`gc.get_objects` , :func:`gc.get_referrers` and
967+ Add audit hooks for :func:`gc.get_objects` , :func:`gc.get_referrers` and
968968:func:`gc.get_referents` . (Contributed by Pablo Galindo in :issue:`43439 ` .)
969969
970970glob
971971----
972972
973- Added the * root_dir* and * dir_fd* parameters in :func:`~ glob.glob` and
973+ Add the * root_dir* and * dir_fd* parameters in :func:`~ glob.glob` and
974974:func:`~ glob.iglob` which allow to specify the root directory for searching.
975975(Contributed by Serhiy Storchaka in :issue:`38144 ` .)
976976
@@ -1039,7 +1039,7 @@ inspect
10391039When a module does not define `` __loader__`` , fall back to `` __spec__ .loader`` .
10401040(Contributed by Brett Cannon in :issue:`42133 ` .)
10411041
1042- Added :func:`inspect.get_annotations` , which safely computes the annotations
1042+ Add :func:`inspect.get_annotations` , which safely computes the annotations
10431043defined on an object . It works around the quirks of accessing the annotations
10441044on various types of objects, and makes very few assumptions about the object
10451045it examines. :func:`inspect.get_annotations` can also correctly un- stringize
@@ -1048,7 +1048,7 @@ best practice for accessing the annotations dict defined on any Python object;
10481048for more information on best practices for working with annotations, please see
10491049:ref:`annotations- howto` .
10501050Relatedly, :func:`inspect.signature` ,
1051- :func:`inspect.Signature.from_callable` , and `` inspect.Signature.from_function` `
1051+ :func:`inspect.Signature.from_callable` , and :func: ` inspect.Signature.from_function`
10521052now call :func:`inspect.get_annotations` to retrieve annotations. This means
10531053:func:`inspect.signature` and :func:`inspect.Signature.from_callable` can
10541054also now un- stringize stringized annotations.
@@ -1063,41 +1063,41 @@ When a module does not define ``__loader__``, fall back to ``__spec__.loader``.
10631063os
10641064--
10651065
1066- Added :func:`os.cpu_count()` support for VxWorks RTOS .
1066+ Add :func:`os.cpu_count()` support for VxWorks RTOS .
10671067(Contributed by Peixing Xin in :issue:`41440 ` .)
10681068
1069- Added a new function :func:`os.eventfd` and related helpers to wrap the
1069+ Add a new function :func:`os.eventfd` and related helpers to wrap the
10701070`` eventfd2`` syscall on Linux.
10711071(Contributed by Christian Heimes in :issue:`41001 ` .)
10721072
1073- Added :func:`os.splice()` that allows to move data between two file
1073+ Add :func:`os.splice()` that allows to move data between two file
10741074descriptors without copying between kernel address space and user
10751075address space, where one of the file descriptors must refer to a
10761076pipe. (Contributed by Pablo Galindo in :issue:`41625 ` .)
10771077
1078- Added :data:`~ os.O_EVTONLY ` , :data:`~ os.O_FSYNC ` , :data:`~ os.O_SYMLINK `
1078+ Add :data:`~ os.O_EVTONLY ` , :data:`~ os.O_FSYNC ` , :data:`~ os.O_SYMLINK `
10791079and :data:`~ os.O_NOFOLLOW_ANY ` for macOS.
10801080(Contributed by Dong- hee Na in :issue:`43106 ` .)
10811081
10821082pathlib
10831083------ -
10841084
1085- Added slice support to :attr:`PurePath.parents < pathlib.PurePath.parents> ` .
1085+ Add slice support to :attr:`PurePath.parents < pathlib.PurePath.parents> ` .
10861086(Contributed by Joshua Cannon in :issue:`35498 ` )
10871087
1088- Added negative indexing support to :attr:`PurePath.parents
1088+ Add negative indexing support to :attr:`PurePath.parents
10891089< pathlib.PurePath.parents> `.
10901090(Contributed by Yaroslav Pankovych in :issue:`21041 ` )
10911091
1092- Added :meth:`Path.hardlink_to < pathlib.Path.hardlink_to> ` method that
1092+ Add :meth:`Path.hardlink_to < pathlib.Path.hardlink_to> ` method that
10931093supersedes :meth:`~ pathlib.Path.link_to` . The new method has the same argument
10941094order as :meth:`~ pathlib.Path.symlink_to` .
10951095(Contributed by Barney Gale in :issue:`39950 ` .)
10961096
10971097platform
10981098--------
10991099
1100- Added :func:`platform.freedesktop_os_release()` to retrieve operation system
1100+ Add :func:`platform.freedesktop_os_release()` to retrieve operation system
11011101identification from `freedesktop.org os- release
11021102< https:// www.freedesktop.org/ software/ systemd/ man/ os- release.html> `_ standard file .
11031103(Contributed by Christian Heimes in :issue:`28468 ` )
@@ -1111,13 +1111,13 @@ pprint
11111111py_compile
11121112----------
11131113
1114- Added `` -- quiet`` option to command- line interface of :mod:`py_compile` .
1114+ Add `` -- quiet`` option to command- line interface of :mod:`py_compile` .
11151115(Contributed by Gregory Schevchenko in :issue:`38731 ` .)
11161116
11171117pyclbr
11181118------
11191119
1120- Added an `` end_lineno`` attribute to the `` Function`` and `` Class``
1120+ Add an `` end_lineno`` attribute to the `` Function`` and `` Class``
11211121objects in the tree returned by :func:`pyclbr.readline` and
11221122:func:`pyclbr.readline_ex` . It matches the existing (start) `` lineno`` .
11231123(Contributed by Aviral Srivastava in :issue:`38307 ` .)
@@ -1132,7 +1132,7 @@ instead of :mod:`pickle` protocol ``3`` when creating shelves.
11321132statistics
11331133----------
11341134
1135- Added :func:`~ statistics.covariance` , Pearson' s
1135+ Add :func:`~ statistics.covariance` , Pearson' s
11361136:func:`~ statistics.correlation` , and simple
11371137:func:`~ statistics.linear_regression` functions.
11381138(Contributed by Tymoteusz Wołodźko in :issue:`38490 ` .)
@@ -1149,7 +1149,7 @@ socket
11491149The exception :exc:`socket.timeout` is now an alias of :exc:`TimeoutError ` .
11501150(Contributed by Christian Heimes in :issue:`42413 ` .)
11511151
1152- Added option to create MPTCP sockets with `` IPPROTO_MPTCP ``
1152+ Add option to create MPTCP sockets with `` IPPROTO_MPTCP ``
11531153(Contributed by Rui Cunha in :issue:`43571 ` .)
11541154
11551155ssl
@@ -1229,7 +1229,7 @@ simulate (the default is still :data:`signal.SIGINT`).
12291229threading
12301230-------- -
12311231
1232- Added :func:`threading.gettrace` and :func:`threading.getprofile` to
1232+ Add :func:`threading.gettrace` and :func:`threading.getprofile` to
12331233retrieve the functions set by :func:`threading.settrace` and
12341234:func:`threading.setprofile` respectively.
12351235(Contributed by Mario Corchero in :issue:`42251 ` .)
@@ -1251,7 +1251,7 @@ as a positional-only argument.
12511251types
12521252---- -
12531253
1254- Reintroduced the :data:`types.EllipsisType` , :data:`types.NoneType`
1254+ Reintroduce the :data:`types.EllipsisType` , :data:`types.NoneType`
12551255and :data:`types.NotImplementedType` classes, providing a new set
12561256of types readily interpretable by type checkers.
12571257(Contributed by Bas van Beek in :issue:`41810 ` .)
@@ -1355,12 +1355,12 @@ Optimizations
13551355
13561356* Use a new output buffer management code for :mod:`bz2` / :mod:`lzma` /
13571357 :mod:`zlib` modules, and add `` .readall()`` function to
1358- `` _compression.DecompressReader`` class . bz2 decompression 1. 09x ~ 1. 17x
1358+ `` _compression.DecompressReader`` class . bz2 decompression is now 1. 09x ~ 1. 17x
13591359 faster, lzma decompression 1. 20x ~ 1. 32x faster, `` GzipFile.read(- 1 )`` 1. 11x
13601360 ~ 1. 18x faster. (Contributed by Ma Lin, reviewed by Gregory P. Smith, in :issue:`41486 ` )
13611361
13621362* When using stringized annotations, annotations dicts for functions are no longer
1363- created when the function is created. Instead, they' re stored as a tuple of
1363+ created when the function is created. Instead, they are stored as a tuple of
13641364 strings, and the function object lazily converts this into the annotations dict
13651365 on demand. This optimization cuts the CPU time needed to define an annotated
13661366 function by half.
@@ -1371,13 +1371,13 @@ Optimizations
13711371 algorithm to avoid quadratic behavior on long strings. (Contributed
13721372 by Dennis Sweeney in :issue:`41972 ` )
13731373
1374- * Added micro- optimizations to `` _PyType_Lookup()`` to improve type attribute cache lookup
1374+ * Add micro- optimizations to `` _PyType_Lookup()`` to improve type attribute cache lookup
13751375 performance in the common case of cache hits. This makes the interpreter 1.04 times faster
1376- in average (Contributed by Dino Viehland in :issue:`43452 ` )
1376+ on average. (Contributed by Dino Viehland in :issue:`43452 ` )
13771377
1378- * Following built- in functions now support the faster :pep:`590 ` vectorcall calling convention:
1378+ * The following built- in functions now support the faster :pep:`590 ` vectorcall calling convention:
13791379 :func:`map ` , :func:`filter ` , :func:`reversed ` , :func:`bool ` and :func:`float ` .
1380- (Contributed by Dong- hee Na and Jeroen Demeyerin in :issue:`43575 ` , :issue:`43287 ` , :issue:`41922 ` , :issue:`41873 ` and :issue:`41870 ` )
1380+ (Contributed by Dong- hee Na and Jeroen Demeyer in :issue:`43575 ` , :issue:`43287 ` , :issue:`41922 ` , :issue:`41873 ` and :issue:`41870 ` )
13811381
13821382* :class :`BZ2File` performance is improved by removing internal `` RLock`` .
13831383 This makes :class :`BZ2File` thread unsafe in the face of multiple simultaneous
@@ -1492,11 +1492,11 @@ Deprecated
14921492 scheduled for removal in Python 3.12 .
14931493 (Contributed by Erlend E. Aasland in :issue:`42264 ` .)
14941494
1495- * :func:`asyncio.get_event_loop` emits now a deprecation warning if there is
1496- no running event loop. In future it will be an alias of
1495+ * :func:`asyncio.get_event_loop` now emits a deprecation warning if there is
1496+ no running event loop. In the future it will be an alias of
14971497 :func:`~ asyncio.get_running_loop` .
14981498 :mod:`asyncio` functions which implicitly create a :class :`~ asyncio.Future`
1499- or :class :`~ asyncio.Task` objects emit now
1499+ or :class :`~ asyncio.Task` objects now emit
15001500 a deprecation warning if there is no running event loop and no explicit
15011501 * loop* argument is passed: :func:`~ asyncio.ensure_future` ,
15021502 :func:`~ asyncio.wrap_future` , :func:`~ asyncio.gather` ,
@@ -1509,7 +1509,7 @@ Deprecated
15091509 deprecated, scheduled for removal in Python 3.12 . Its use is strongly
15101510 discouraged by the SQLite3 documentation. See `the SQLite3 docs
15111511 < https:// sqlite.org/ c3ref/ enable_shared_cache.html> `_ for more details.
1512- If shared cache must be used, open the database in URI mode using the
1512+ If a shared cache must be used, open the database in URI mode using the
15131513 `` cache=shared`` query parameter.
15141514 (Contributed by Erlend E. Aasland in :issue:`24464 ` .)
15151515
@@ -1553,7 +1553,7 @@ Removed
15531553
15541554* The `` ParserBase.error()`` method from the private and undocumented `` _markupbase``
15551555 module has been removed. :class :`html.parser.HTMLParser` is the only subclass of
1556- `` ParserBase`` and its `` error()`` implementation has already been removed in
1556+ `` ParserBase`` and its `` error()`` implementation was already removed in
15571557 Python 3.5 .
15581558 (Contributed by Berker Peksag in :issue:`31844 ` .)
15591559
@@ -1646,7 +1646,7 @@ Changes in the Python API
16461646 :doc:`high- level API < ../ library/ asyncio- api- index> ` following deprecation
16471647 in Python 3.8 .
16481648
1649- A coroutine that currently look like this::
1649+ A coroutine that currently looks like this::
16501650
16511651 async def foo(loop):
16521652 await asyncio.sleep(1 , loop = loop)
@@ -1695,7 +1695,7 @@ Build Changes
16951695* The :mod:`atexit` module must now always be built as a built- in module.
16961696 (Contributed by Victor Stinner in :issue:`42639 ` .)
16971697
1698- * Added :option:`-- disable- test- modules` option to the `` configure`` script:
1698+ * Add :option:`-- disable- test- modules` option to the `` configure`` script:
16991699 don' t build nor install test modules.
17001700 (Contributed by Xavier de Gaye, Thomas Petazzoni and Peixing Xin in :issue:`27640 ` .)
17011701
@@ -1759,15 +1759,15 @@ New Features
17591759 sending value into iterator without raising `` StopIteration `` exception.
17601760 (Contributed by Vladimir Matveev in :issue:`41756 ` .)
17611761
1762- * Added :c:func:`PyUnicode_AsUTF8AndSize` to the limited C API .
1762+ * Add :c:func:`PyUnicode_AsUTF8AndSize` to the limited C API .
17631763 (Contributed by Alex Gaynor in :issue:`41784 ` .)
17641764
1765- * Added :c:func:`PyModule_AddObjectRef` function: similar to
1765+ * Add :c:func:`PyModule_AddObjectRef` function: similar to
17661766 :c:func:`PyModule_AddObject` but don' t steal a reference to the value on
17671767 success.
17681768 (Contributed by Victor Stinner in :issue:`1635741 ` .)
17691769
1770- * Added :c:func:`Py_NewRef` and :c:func:`Py_XNewRef` functions to increment the
1770+ * Add :c:func:`Py_NewRef` and :c:func:`Py_XNewRef` functions to increment the
17711771 reference count of an object and return the object .
17721772 (Contributed by Victor Stinner in :issue:`42262 ` .)
17731773
@@ -1787,7 +1787,7 @@ New Features
17871787 object is an instance of :class :`set ` but not an instance of a subtype.
17881788 (Contributed by Pablo Galindo in :issue:`43277 ` .)
17891789
1790- * Added :c:func:`PyErr_SetInterruptEx` which allows passing a signal number
1790+ * Add :c:func:`PyErr_SetInterruptEx` which allows passing a signal number
17911791 to simulate.
17921792 (Contributed by Antoine Pitrou in :issue:`43356 ` .)
17931793
@@ -1812,7 +1812,7 @@ New Features
18121812 singleton or the `` False `` singleton.
18131813 (Contributed by Victor Stinner in :issue:`43753 ` .)
18141814
1815- * Add new functions to quickly control the garbage collector from C code:
1815+ * Add new functions to control the garbage collector from C code:
18161816 :c:func:`PyGC_Enable()` ,
18171817 :c:func:`PyGC_Disable()` ,
18181818 :c:func:`PyGC_IsEnabled()` .
0 commit comments