Assignment operator: incorrect wording
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 36k
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 558
Mô tả
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?
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Xem lại các phần được liên kết trong Language Reference về các câu lệnh đơn giản và phân tích từ vựng, cùng với mục chú giải về biểu thức và bảng độ ưu tiên của toán tử. Tìm trong tài liệu các chỗ sử dụng “assignment operator” và xác định chỗ nào nên ghi là “assignment statement”, sau đó kiểm tra để bảo đảm thuật ngữ nhất quán với phần văn bản tham chiếu xung quanh.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- documentation
- Loại issue
- Tài liệu
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100