treat uppercase variables as `Final`
オープン
まだ誰も着手していません。
feature
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Feature
A = 1
A = 2
make A be treated as
from typing import Final
A: Final = 1
A = 2
thus, it will emit error with
test.py:1: error: Cannot assign to final name "A" (because it is uppercase)
Found 1 error in 1 file (checked 1 source file)
Pitch
It would be convenient to not add Final to uppercase variables.
Since pep 8 states that constants are named with uppercase, uppercase variables could be considered Final.

Pylance also uses this convention and warns when UPPERCASE variables are mutated.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、mypy が現在 typing.Final で注釈付けされた名前への代入をどのように処理しているかを追跡し、次にその処理経路を、issue で説明されている大文字定数の規約と比較します。動作ケースとして test.py の例を使用してください。一度初期化された大文字の名前は final として扱われるべきであり、その後の代入では示されているエラーが発生するべきです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100