String formatting with two dictionaries?

piet at cs.uu.nl piet at cs.uu.nl
Tue Oct 9 13:29:32 CEST 2001


>>>>> Carsten Gaebler <clpy at snakefarm.org> (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 cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl



More information about the Python-list mailing list