You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Order of overloads of index method can cause failure to type-check when a type is a sequence of itself (example: str) #100
mypy sees we are calling index with a str and...this matches the first overload, as str is a Sequence[str]. mypy then concludes that the result is a list[int], causing the error.
The solution is to re-order the overloads so mypy sees, and uses, what is currently the second one. The actual implementation of index already does the right thing for strs.
Activity
Re-order overloads for index method to fix type-checking edge case
startrekdude commentedon Jan 20, 2025
Pull request submitted.