Good point, and thanks for pointing out defaultdict(); I wasn't even aware of that class. I suppose one could use defaultdict() to gain associativity also (pass 'not found' variables through unmodified). I think I still slightly prefer replace(), for uninteresting reasons.