String formatting with two dictionaries?

piet at piet at
Tue Oct 9 13:29:32 CEST 2001

>>>>> Carsten Gaebler <clpy at> (CG) writes:

CG> Thanks for all the answers. Seems as if I hadn't been specific
CG> enough about what I was looking for. It would be nice if there was
CG> some builtin dictionary magic that would allow

CG> "%(foo) %(bar)" % magic(dict1, dict2, ...)

CG> where in case of duplicate keys the leftmost dictionary would be
CG> preferred.

CG> Perhaps the builtin dictionary() class could be extended so that
CG> it accepts more than one dictionary argument?

My solution gave you that.
Piet van Oostrum <piet at>
Private email: P.van.Oostrum at

More information about the Python-list mailing list