Why the following code does not trigger dangerous-default-value
for items
when using pylint
? Is this an unintended feature of pylint
(i.e. a bug)?
def func(item, items=([],)):
items[0].append(item)
return items
My understanding is that it should be all means do, since:
print(func(1))
# ([1],)
print(func(2))
# ([1, 2],)
Is there a standard way of sanitize this, or do I have to do it by myself?
(Note: This is just toy code to illustrate the issue.)