spylang/spy

Nested tuple unpacking

开放

#456 创建于 2026年4月7日

 (1 条评论) (0 个反应) (0 位负责人)Python (60 个派生)auto 404
good first issuehelp wanted

仓库指标

星标
 (803 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

WARNING - full AI-assisted solutions are not welcome for this issue The point of "Good first issues" is to give a chance to humans to interact and learn about the codebase. Writing code using AI assistant prevents this.


This should work:

def main() -> None:
    tup = (1, (2, 3))
    a, (b, c) = tup
    print(a + b + c)

Currently it fails with AssertionError in the parser:

❯ spy /tmp/x.spy 
Traceback (most recent call last):
[...]
  File "/home/antocuni/anaconda/spy/spy/parser.py", line 544, in from_py_stmt_Assign
    assert isinstance(item, py_ast.Name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

贡献者指南