Assignment operator: incorrect wording
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Two quotes from The Python 3.11.0 Language Reference (emphasize is mine):
- Note: If the object is a class instance and the attribute reference occurs on both sides of the assignment operator
- Delimiters: The second half of the list, the augmented assignment operators, serve lexically as delimiters, but also perform an operation
As explained at the expression entry term in the glossary, an operator is a syntatical element involved in an expression. An expression has a value. The piece of syntax (a = expr) is not an expression because it cannot be evaluated. And as explained at the same entry, assignment are also statement, not expression.
In the same way there is no del/return operator, it is not correct to invoke an assignment operator, the correct wording being "assignment statement" as used in many places in The Python Language Reference Manual. The only "assignment operator" we can figure out is the walrus operator because (a := expr) has a value.
For consistency, we can observe that assignment symbols (=, +=, etc), contrary to the walrus symbol, are not listed in:
Thomas Wouters explains in a SO comment :
Assignment is actually not an expression in Python, and
=not an operator in the normal sense; operator precedence doesn't apply.
Related reference of interest: = is not an operator
EDIT:
- Alex Martelli agrees here:
...doesn't exist, since '=' is not an operator in Python (just like it isn't, say, in VB). But, OK, you mean "assignment".
- Another reference of interest: Is assignment an operator in Python?
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
檢閱關於簡單陳述式和詞法分析的 Language Reference 連結章節,以及運算式詞彙表項目和運算子優先順序表。在文件中搜尋「assignment operator」的使用方式,並判斷哪些地方應該寫成「assignment statement」,然後確認術語與周圍的參考文字一致。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- documentation
- Issue 類型
- 文件
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100