Consider special casing zip(*tuples)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 32/100
Hướng nghiên cứu
Start by tracing how mypy infers zip(*a) and checks multiple assignment. The issue gives the target example and proposed tuple shape, but no files, tests, or implementation entry points are identified. Done would require a precise contextual type without making zip inference unsound elsewhere, along with coverage for the shown case.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
This seems to be a somewhat common zip idiom:
>>> a = [('a', 1), ('b', 2), ('c', 3)]
>>> list(zip(*a))
[('a', 'b', 'c'), (1, 2, 3)]
The inferred type for zip(*a) is Iterator[Tuple[Any, ...]], which causes false negatives in multiple assignments like this:
x, y = zip(*a)
Maybe we could add a plugin feature that can provide more precise types for zip(*a) in a multiple assignment context somehow. For example, the inferred type in the above example could be Tuple[Tuple[str, ...], Tuple[int, ...]] instead of Iterator[...], but only in the context of a multiple assignment since elsewhere the inferred type is not safe to use.
- 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
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.
Issue khác của python/mypy
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug topic-configuration topic-error-reporting
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
zostera/django-bootstrap4#894 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
use-agent-os/agent-os#3276 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
NousResearch/hermes-agent#117848 ·