Skip to content

Include close matches in error message when key not found #30001

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented May 2, 2025

This is an attempt to resurrect #28115, but make it more general so we can emit helpful error messages when keys aren't found.

@dstansby dstansby changed the title Include close matches when key not found Include close matches in error message when key not found May 2, 2025
@@ -139,6 +140,35 @@ def check_in_list(values, /, *, _print_supported_values=True, **kwargs):
raise ValueError(msg)


def check_in_keys(value, mappable, *,
Copy link
Member

Choose a reason for hiding this comment

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

This is basically a dupe of check_getitem, except with an additional error message?

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.

2 participants