Skip to content

Make filter() use TypeGuard #5661

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
JelleZijlstra opened this issue Jun 19, 2021 · 5 comments
Closed

Make filter() use TypeGuard #5661

JelleZijlstra opened this issue Jun 19, 2021 · 5 comments

Comments

@JelleZijlstra
Copy link
Member

This will probably require a lot of overloads.

@layday
Copy link
Contributor

layday commented Jun 21, 2021

Does it not require just the one extra overload?

@overload
def __init__(self, __function: Callable[[_S], TypeGuard[_T]], __iterable: Iterable[_S]) -> None: ...

@sobolevn
Copy link
Member

sobolevn commented Oct 9, 2021

Related https://github.com/python/mypy/blob/05f38571f1b7af46dbadaeba0f74626d3a9e07c9/test-data/unit/check-typeguard.test#L250-L274

I think we can try to add this feature based on this existing test.
I will make an attempt to fix this.

@AlexWaygood
Copy link
Member

Fixed by #5661

@laundmo
Copy link

laundmo commented Jan 16, 2023

Fixed by #5661

This links to the current issue, not the PR implementing this.

@AlexWaygood
Copy link
Member

Fixed by #5661

This links to the current issue, not the PR implementing this.

Thanks, I meant #6726.

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 a pull request may close this issue.

5 participants