Document how joins work

Đang mở
#5,219 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tài liệu
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
documentation

Hướng nghiên cứu

Start by locating the mypy documentation covering type inference for collections and related typing behavior. Use the A, B, and C example from the issue to verify how inferred common base classes differ from an explicitly annotated Union. Done means the behavior is explained with accessible examples without relying heavily on the term “join”.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

documentation priority-1-normal topic-join-v-union

Joins tend to produce common base classes instead of unions, and this may be surprising. I don't think that this is documented, at least not very clearly. The discussion probably shouldn't rely heavily on the relatively obscure term "join" (especially as the operation technically isn't quite a lattice join) -- rather we can use examples and more informal explanations.

Typical example where this is relevant:

class A: pass
class B(A): pass
class C(A): pass

x = [B(), C()]  # Inferrred type List[A], not List[Union[B, C]]
y: List[Union[B, C]]
y = [B(), C()]  # Now the type is List[Union[B, C]]
Ngôn ngữ chính
Python
Star
20.6k
Fork
3.3k
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
54

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của python/mypy

Tất cả issue của python/mypy

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.