Skip to content

Commit cea69c4

Browse files
authored
Merge pull request #498 from python/main
Sync Fork from Upstream Repo
2 parents 43ac984 + 9ee8448 commit cea69c4

22 files changed

Lines changed: 144 additions & 134 deletions

Doc/howto/enum.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ overridden::
286286
... EAST = auto()
287287
... WEST = auto()
288288
...
289-
>>> [member.value for member in Color]
289+
>>> [member.value for member in Ordinal]
290290
['NORTH', 'SOUTH', 'EAST', 'WEST']
291291

292292
.. note::

Doc/library/random.rst

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ Bookkeeping functions
8686
.. versionchanged:: 3.2
8787
Moved to the version 2 scheme which uses all of the bits in a string seed.
8888

89-
.. deprecated:: 3.9
90-
In the future, the *seed* must be one of the following types:
89+
.. versionchanged:: 3.11
90+
The *seed* must be one of the following types:
9191
*NoneType*, :class:`int`, :class:`float`, :class:`str`,
9292
:class:`bytes`, or :class:`bytearray`.
9393

@@ -208,13 +208,10 @@ Functions for sequences
208208
Raises a :exc:`ValueError` if all weights are zero.
209209

210210

211-
.. function:: shuffle(x[, random])
211+
.. function:: shuffle(x)
212212

213213
Shuffle the sequence *x* in place.
214214

215-
The optional argument *random* is a 0-argument function returning a random
216-
float in [0.0, 1.0); by default, this is the function :func:`.random`.
217-
218215
To shuffle an immutable sequence and return a new shuffled list, use
219216
``sample(x, k=len(x))`` instead.
220217

@@ -230,8 +227,8 @@ Functions for sequences
230227

231228
.. function:: sample(population, k, *, counts=None)
232229

233-
Return a *k* length list of unique elements chosen from the population sequence
234-
or set. Used for random sampling without replacement.
230+
Return a *k* length list of unique elements chosen from the population
231+
sequence. Used for random sampling without replacement.
235232

236233
Returns a new list containing elements from the population while leaving the
237234
original population unchanged. The resulting list is in selection order so that
@@ -257,11 +254,10 @@ Functions for sequences
257254
.. versionchanged:: 3.9
258255
Added the *counts* parameter.
259256

260-
.. deprecated:: 3.9
261-
In the future, the *population* must be a sequence. Instances of
262-
:class:`set` are no longer supported. The set must first be converted
263-
to a :class:`list` or :class:`tuple`, preferably in a deterministic
264-
order so that the sample is reproducible.
257+
.. versionchanged:: 3.11
258+
259+
The *population* must be a sequence. Automatic conversion of sets
260+
to lists is longer supported.
265261

266262

267263
.. _real-valued-distributions:

Doc/library/typing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,10 +799,10 @@ These can be used as types in annotations using ``[]``, each having a unique syn
799799
.. versionadded:: 3.8
800800

801801
.. versionchanged:: 3.9.1
802-
``Literal`` now de-duplicates parameters. Equality comparison of
802+
``Literal`` now de-duplicates parameters. Equality comparisons of
803803
``Literal`` objects are no longer order dependent. ``Literal`` objects
804804
will now raise a :exc:`TypeError` exception during equality comparisons
805-
if one of their parameters are not :term:`immutable`.
805+
if one of their parameters are not :term:`hashable`.
806806

807807
.. data:: ClassVar
808808

Doc/reference/compound_stmts.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ Syntax:
797797
capture_pattern: !'_' NAME
798798

799799
A single underscore ``_`` is not a capture pattern (this is what ``!'_'``
800-
expresses). And is instead treated as a :token:`wildcard_pattern`.
800+
expresses). It is instead treated as a :token:`wildcard_pattern`.
801801

802802
In a given pattern, a given name can only be bound once. E.g.
803803
``case x, x: ...`` is invalid while ``case [x] | x: ...`` is allowed.
@@ -820,7 +820,9 @@ and binds no name. Syntax:
820820
.. productionlist:: python-grammar
821821
wildcard_pattern: '_'
822822

823-
``_`` is a :ref:`soft keyword <soft-keywords>`.
823+
``_`` is a :ref:`soft keyword <soft-keywords>` within any pattern,
824+
but only within patterns. It is an identifier, as usual, even within
825+
``match`` headers, ``guards``, and ``case`` blocks.
824826

825827
In simple terms, ``_`` will always succeed.
826828

Doc/tutorial/errors.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,10 @@ points discuss more complex cases when an exception occurs:
405405
or :keyword:`!else` clause. Again, the exception is re-raised after
406406
the :keyword:`!finally` clause has been executed.
407407

408+
* If the :keyword:`!finally` clause executes a :keyword:`break`,
409+
:keyword:`continue` or :keyword:`return` statement, exceptions are not
410+
re-raised.
411+
408412
* If the :keyword:`!try` statement reaches a :keyword:`break`,
409413
:keyword:`continue` or :keyword:`return` statement, the
410414
:keyword:`!finally` clause will execute just prior to the

0 commit comments

Comments
 (0)