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

Add specific message for type errors on dict displays #3100

Merged
merged 1 commit into from
Apr 4, 2017

Conversation

dmoisset
Copy link
Contributor

This fixes #304, #1183, and #2538

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Thanks! This is a really long-standing issue and it's great to see this fixed. Just one nit about terminology in the messages.

name = callee.name[1:-1]
n -= 1
key_type, value_type = cast(TupleType, arg_type).items
msg = '{} entry {} has incompatible type {}: {}'.format(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe use item instead of entry, similar to the naming of the items() method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've seen "entry" used for dictionaries (example: https://docs.python.org/3/reference/expressions.html#dictionary-displays) quite often; item too but it's more ambiguous (it's also used for lists). I don't mind changing it to avoid bikeshedding if you still prefer it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, entry seems official enough so let's keep it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing error message for dict literal
2 participants