|
|
|
|
|
by LtWorf
14 days ago
|
|
It's just because the `def xxx()` part gets executed once when the module is loaded so the default arguments get created then. It's not really a design choice. If you declare a function inside a for loop with the default argument set to a list, it will be re-declared at every iteration of the loop and the list of the default argument will be a new instance every time. |
|
I understand as much.
> It's not really a design choice.
That explains it then. Pretty damning though, no?