This inspection detects when a mutable value as list or dictionary is detected in a default value for an argument. Default argument values are evaluated only once at function definition time, which means that modifying the default value of the argument will affect all subsequent calls of the function.
官方解释.
你试试打印id(list1)和id(list3),是同一个地址
id(list2)是另一个地址,list1和list3使用的都是默认的那个列表,list2返回的是你传进去的那个列表.虽然都是空列表,但实际是两个空列表.
不可能出现
[10]
[123]
['a']
若你改变打印位置,顶多只能出现
[10]
[123]
[10, 'a']