Skip to content

Validity of collections.deque as typing.Sequence #12047

Open
@einarwar

Description

@einarwar

Hi

Based on this discussion on pyright: microsoft/pyright#7989 (comment)

A collections.deque is a valid typing.Sequence. However, typing.Sequence allows being sliceable, while a collections.deque does not support slicing. This makes room to make errors that is not caught by static type checkers like pyright and mypy.

It seems like this normally would be reported, but the errors are suppressed by type-ignore comments found here.

Is there any other way of handling this so that trying to slice a deque would result in a type-error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    stubs: false negativeType checkers do not report an error, but should

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions