mutable_func_default_arg

Python

shaozkshaozk python/mutable_func_default_arg.py · 7 行 · 更新于 2026-09-03

def func(name: str, items: list = []):
    items.append(name)
    print(items)


func("hello")
func("world")

评论