3 ms·
I've been coding in Python for 8 years now and only this year came up against this behavior. I had a good long laugh after realizing what had just eaten up my p
by akoumjian 13y ago
I've been coding in Python for 8 years now and only this year came up against this behavior. I had a good long laugh after realizing what had just eaten up my previous couple hours.
I actually figured it out by printing out the id of the object being modified in my code, and when seeing it was the same had to really scratch my head. Default args are initialized when the function (or similarly, class) is defined, not when executed.