Extend operator-typo SyntaxError suggestions (`=<`, `=>`, `=!`) to `if/while` other conditions
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Follow-up #151375
In that PR we added helpful SyntaxError messages for common operator typos: =< suggests <=, => suggests >=, and =! suggests !=.
These suggestions currently only work when the typo appears in a plain statement. like
'a => b' invalid syntax. Maybe you meant '>=' instead of '=>'?
So this is for extending in if, while, or other conditions:
These only fire for bare statements, so
if a => b:still gives the generic error, no? That is probably fine for a first iteration (the= <tokenization makes it look like an assignment), but maybe we should add a test documenting it or a follow-up issue for theif/whilecase.
Originally posted by @pablogsal in https://github.com/python/cpython/pull/151375#discussion_r3683730462
I'm planning to work on this and submit a PR shortly after the follow up merged, please avoid PR in this
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず PR #151375 と既存の SyntaxError 提案実装を読んで、単独の文で演算子のタイプミスがどのように検出されるかを理解します。その動作を if、while、その他の条件ケースに拡張し、続いてそれらの形式を対象とするテストを追加または更新して、提案されるメッセージを検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100