Skip to content

Mypy throws error using sorted with a key function specified #1160

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

Closed
timabbott opened this issue Jan 26, 2016 · 2 comments
Closed

Mypy throws error using sorted with a key function specified #1160

timabbott opened this issue Jan 26, 2016 · 2 comments
Labels
bug mypy got something wrong

Comments

@timabbott
Copy link

Reproducer: sorted([{'name': 'test'}], key=lambda x: x['name'])

Moved from #1150.

@gvanrossum
Copy link
Member

The error is: Value of type object is not indexable. It's about the `x['name'] in the lambda. Almost feels like the type variable leaked or got substituted wrong. Maybe an issue in infer_function_type_arguments()?

@gvanrossum gvanrossum added the bug mypy got something wrong label Jan 26, 2016
@JukkaL JukkaL closed this as completed in a4cc2db Jan 28, 2016
@timabbott
Copy link
Author

Confirmed the fix in my application, thanks @JukkaL !

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

No branches or pull requests

2 participants