Document FrameLocalsProxy behaviour quirks
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Following PEP 667, https://docs.python.org/dev/reference/datamodel.html#frame-objects mentions that frame.f_locals may be a write-through proxy object, but doesn't really explain what that means.
Once https://github.com/python/peps/pull/3845 lands PEP 667 will contain such a description, but the main docs should at least cover the key behaviours:
- new instance on every attribute access
- two proxies with the same keys and values will still be unequal if they refer to different frames
- extra keys can be stored and are stored on the frame itself so they're shared across all proxies for the same frame
- keys corresponding to local variables can't be deleted
.copy()(and any other API that produces a new container) returns a regulardictinstance
Suggested location would be as a new 4th subsection under the frame objects section linked above. A "see also" from that new subsection back to PEP 667 would also be a useful addition.
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
Bắt đầu với phần về các đối tượng frame trong tài liệu mô hình dữ liệu Python và xem lại PEP 667, bao gồm cả pull request PEP được liên kết. Thêm một tiểu mục thứ tư mô tả năm hành vi được liệt kê của FrameLocalsProxy và một liên kết xem thêm trở về PEP 667. Được xem là hoàn tất khi tài liệu chính giải thích về định danh proxy, các khóa bổ sung được chia sẻ, các biến cục bộ không thể xóa và các API tạo ra dict.
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ó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 88/100