Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP 653: Delete out-of-date note and correct tests in mapping pattern translations. #1895

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions pep-0653.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ translates to::

if $kind & MATCH_MAPPING == 0:
FAIL
if $value.keys() != $KEYWORD_PATTERNS.keys():
if not $value.keys() >= $KEYWORD_PATTERNS.keys():
FAIL
# $KEYWORD_PATTERNS is a meta-variable mapping names to variables.
for $KEYWORD in $KEYWORD_PATTERNS:
Expand All @@ -283,7 +283,7 @@ translates to::

if $kind & MATCH_MAPPING == 0:
FAIL
if $value.keys() not >= $KEYWORD_PATTERNS.keys():
if not $value.keys() >= $KEYWORD_PATTERNS.keys():
FAIL:
# $KEYWORD_PATTERNS is a meta-variable mapping names to variables.
$tmp = dict($value)
Expand Down Expand Up @@ -347,11 +347,6 @@ translates to::

Example: [6]_

.. note::

``__match_args__`` is not checked when matching positional-only class patterns,
this allows classes to match only positional-only patterns by leaving ``__match_args__`` set to the default value of ``None``.

Class patterns with all keyword patterns::

case ClsName($KEYWORD_PATTERNS):
Expand Down