PEP 634: Describe how keys are compared in mapping patterns (#1675)

This commit is contained in:
Daniel F Moisset 2020-10-23 00:32:17 +01:00 committed by GitHub
parent 871c59e334
commit 5a65e84863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -418,7 +418,9 @@ A mapping pattern fails if the subject value is not an instance of
``collections.abc.Mapping``.
A mapping pattern succeeds if every key given in the mapping pattern
matches the corresponding item of the subject mapping. If a ``'**'
is present in the subject mapping, and the pattern for
each key matches the corresponding item of the subject mapping. Keys
are always compared with the ``==`` operator. If a ``'**'
NAME`` form is present, that name is bound to a ``dict`` containing
remaining key-value pairs from the subject mapping.