Validity of `collections.deque` as `typing.Sequence`
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 5.1k
- フォーク
- 2.1k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 82
説明
Hi
Based on this discussion on pyright: https://github.com/microsoft/pyright/discussions/7989#discussioncomment-9548709
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?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
stdlib/collections/init.pyi の 258 行目付近から始め、リンクされている Pyright の議論を読んでください。pyright と mypy が現在の type-ignore コメントおよび deque と Sequence の関係をどのように扱っているかを比較してください。関連する checker の挙動を考慮したうえで、slicing の制限を表現する typeshed 互換の方法を特定し、合意できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100