Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

PEP 634: Change so __match_args__ must be a tuple#1909

Merged
gvanrossum merged 2 commits into
masterpython/peps:masterfrom
match-args-tuplepython/peps:match-args-tupleCopy head branch name to clipboard
Apr 5, 2021
Merged

PEP 634: Change so __match_args__ must be a tuple#1909
gvanrossum merged 2 commits into
masterpython/peps:masterfrom
match-args-tuplepython/peps:match-args-tupleCopy head branch name to clipboard

Conversation

@gvanrossum

@gvanrossum gvanrossum commented Apr 3, 2021

Copy link
Copy Markdown
Member

This was discussed on python-dev in the thread
https://mail.python.org/archives/list/python-dev@python.org/thread/YYIT3QXMLPNLXQAQ5BCXE4LLJ57EE7JV/#YYIT3QXMLPNLXQAQ5BCXE4LLJ57EE7JV

I don't think anyone disagrees that it's better if __match_args__ is required to be a tuple.

  • This helps static type checkers keep track of the values more easily
  • It allows an optimization in the implementation where the pattern only needs to be recompiled when the value is changed.

@willingc

willingc commented Apr 4, 2021

Copy link
Copy Markdown
Contributor

@gvanrossum It looks like line 498 has an extra "`" around match_args

@gvanrossum

Copy link
Copy Markdown
Member Author

@brandtbucher -- How do you feel about implementing this change?

@brandtbucher

Copy link
Copy Markdown
Member

@gvanrossum No problem, I'll have something up later today.

@gvanrossum

Copy link
Copy Markdown
Member Author

I think this is now sufficiently non-controversial that I'm just changing the PEP and we'll update the implementation ASAP (not sure if it will make 3.10a7, if not then definitely b1).

@gvanrossum gvanrossum merged commit d635956 into master Apr 5, 2021
@gvanrossum gvanrossum deleted the match-args-tuple branch April 5, 2021 17:38
gvanrossum pushed a commit to python/cpython that referenced this pull request Apr 6, 2021
See:
- python/peps#1909 (__match_args__ must be a tuple)
- python/peps#1908 (allow keyword patterns for int(x) etc.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.