When and why should I use attr.Factory?

Viewed 5273

When and why should I use attr.ib(default=attr.Factory(list)) over attr.ib(default=[])?

From the docs I see that a Factory is used to generate a new value, which makes sense if you are using a lambda expression with inputs; however, I do not understand why you would use it if you are simply generating an empty list.

What am I missing here?

1 Answers
Related