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 634: Reword sequence and mapping patterns sections to be more robust. #1937

Merged
merged 2 commits into from
Apr 26, 2021

Conversation

markshannon
Copy link
Member

This PR makes the behavior of matching sequences and mappings more robust in unusual circumstances.

For example:

  • Pattern matching can be used before collections.abc is imported. This might be important for coverage and profiling tools
  • Registering dict as a collections.abc.Sequence will not make {} match [].
  • Pattern matching cannot fail as a result of collections.abc failing to import.

This change keeps the door open for PEP 653, but is a worthwhile improvement even if PEP 653 is withdrawn or rejected.

…obust and well defined for some corner cases.
Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let's wait for @brandtbucher

Copy link
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for figuring this out! I think it's a good improvement.

Just one minor note:

pep-0634.rst Show resolved Hide resolved
@gvanrossum gvanrossum merged commit 6be7793 into python:master Apr 26, 2021
@brandtbucher
Copy link
Member

@markshannon, I assume you're working on a patch for this?

If not, just let me know and I will take care of it.

@brandtbucher
Copy link
Member

@markshannon, did you see my previous comment?

I can do this if needed, but I should probably start soon if so.

@markshannon
Copy link
Member Author

I'll do it.
I was waiting for the IMMUTABLE flag PR to get merged.

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