Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Closed as not planned
Description
Recently I switch to use pyright as my lsp server. This server is very strict at type annotation, and I found some errors as following.
error: Type "list[int]" is not assignable to declared type "SequenceNotStr[int]" "list[int]" is incompatible with protocol "SequenceNotStr[int]" "index" is an incompatible type Type "(value: int, start: SupportsIndex = 0, stop: SupportsIndex = sys.maxsize, /) -> int" is not assignable to type "(value: Any, /, start: int = 0, stop: int = ...) -> int" Missing keyword parameter "start" Missing keyword parameter "stop" Position-only parameter mismatch; parameter "start" is not position-only Position-only parameter mismatch; parameter "stop" is not position-only (reportAssignmentType)1 error, 0 warnings, 0 informations
so I check the "index" signature of list.index and SequenceNotStr.index, found that:
>>>inspect.signature(list.index)<Signature (self,value,start=0,stop=9223372036854775807,/)>>>>inspect.signature(pd_typing.SequenceNotStr.index)<Signature (self,value:'Any',/,start:'int'=0,stop:'int'=Ellipsis)->'int'>
The signature of list.index make me surprised. Why we set start and stop as the position-only argument to the list.index? I think defined them as position-and-keyword argument is a better idea, so that we can using keyword to set them. Meanwhile i think give default value to position-only argument is a little strange
Metadata
Metadata
Assignees
Projects
Status
Todo