python / python/typing

Clarification: interaction between `@property` and `@final`

オープン
#2,336 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

topic: typing spec
主要言語
Python
スター
1.8k
フォーク
302
平均マージ
23時間
マージ済み PR(30日)
8

説明

The spec for @final says:

The method decorator version may be used with all of instance methods, class methods, static methods, and properties.

and it made me wonder how exactly final interacts with property. There are no conformance tests exercising this specific interaction.

From carefully reading the spec, it seems like the only effect of @final on a property is to prevent it from being overridden in a child class, and that decorating a property with @final does not cause it to be read-only or disallow a setter.

Is my understanding correct? If so, does it make sense to add a clarification to the spec that the decorator does not make a property read-only?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

typing 仕様の @final セクションから始め、プロパティ、setter、継承に関する既存の適合性テストを確認してください。仕様で @final をプロパティに適用する方法が明確に記載され、適切であれば適合性テストで意図した動作が記録されていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
documentation, testing-qa
issue の種類
ドキュメント
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
58/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。