Oh I had a similar bug but with defaulted dicts. Default args are constructed once and reused. Not a problem for immutable args, but mutables like dicts (and sets I'd also assume) are all shared.
EDIT: whoops, didn't see you spoilered the answer, my bad! If it helps, i found my bug when dealing with cross-thread stuff, so that was a fun moment to bisect
Yeah, I discovered this when a coworker wrote code like def foo(timestamp = now()) and had fun debugging why there were a bunch of duplicate timestamps.
PEP 671 would add new syntax to ease the pain, but it's not accepted yet. It would allow for writing function definitions like one of these:
Wow, I learned this bug during a job interview I had this week. I'm not much of a Python guy, but I was givin a Python coding challenge and I tried default initializing a parameter to an empty list.
The guy interviewing me looked horrified and explained the problem and sent me an article about it to read later. It's a odd coincidence coming across it twice in one week.