Improve "not found" error messages in `<sequence>.<method>()` failures
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
The docstring of list.remove() says value parameter as shown below:
print(help(list.remove))
# remove(self, value, /) unbound builtins.list method
# Remove first occurrence of value.
#
# Raises ValueError if the value is not present.
But the error message says x instead of value as shown below and I don't think list.remove(x): is necessary:
v = ['a', 'b', 'c']
v.remove('B')
# ValueError: list.remove(x): x not in list
So, the error message should just say as shown below:
ValueError: value not in list
In addition, the docstring of bytearray.remove() says valueparameter as shown below:
print(help(bytearray.remove))
# remove(self, value, /) unbound builtins.bytearray method
# Remove the first occurrence of a value in the bytearray.
#
# value
# The value to remove.
And, the error message reasonably says value as shown below but I don't think found is necessary:
v = bytearray(b'abc')
v.remove(ord('B'))
# ValueError: value not found in bytearray
So, the error message should just say as shown below:
ValueError: value not in bytearray
Linked PRs
- gh-137509
- gh-139696
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、報告された例を動作の基準として、list.remove() と bytearray.remove() の実装とテストを見つけます。開始する前に、関連する PR gh-137509 と gh-139696 を確認してください。2 つのエラーメッセージが要求された文言と一致し、関連するテストがパスすれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 25/100