del (x, y) 是删除元组 (x, y) 还是单个变量 x 和 y?

Does del (x, y) delete the tuple (x, y) or the individual variables x and y?

假设以下代码:

lid = foo(guz)
tym = bar(jug)

hig(lid, tym)

del (lid, tym)

是否会删除新创建的匿名元组(lid, tym)并且lid仍然可用?
还是 lidtym 都会被删除?

删除变量:

>>> lid, tym = 1, 2
>>> del (lid, tym)
>>> lid
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'lid' is not defined
>>> tym
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'tym' is not defined

来自the docs

7.5. The del statement

del_stmt ::= "del" target_list

...

Deletion of a target list recursively deletes each target, from left to right.

使用del (a, b)将删除变量。

>>> a, b = 1, 2
>>> t = (a, b)
>>> del (a, b)
>>> t
(1, 2)
>>> a
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'a' is not defined
>>> b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'b' is not defined
>>>