String formatting with two dictionaries?

Steve Holden sholden at
Tue Oct 9 13:21:23 CEST 2001

"Carsten Gaebler" <clpy at> wrote ...
> Thanks for all the answers. Seems as if I hadn't been specific
> enough about what I was looking for. It would be nice if there was
> some builtin dictionary magic that would allow
> "%(foo) %(bar)" % magic(dict1, dict2, ...)
> where in case of duplicate keys the leftmost dictionary would be
> preferred.
> Perhaps the builtin dictionary() class could be extended so that
> it accepts more than one dictionary argument?
Well, perhaps it could, but I can't say I've seen much of a case for it.
There are clearly so many ways you can achieve what you require in the
existing language. Wouldn't you say your requirements are a little, erm,
esoteric to be requiring core language changes? Don't forget that from next
year onwards you will be able to inherit from built-in types, so then you'll
not need to change dictionaries, you can just subclass them to your heart's

let's-change-the-programmers-not-the-language-ly y'rs  - steve

More information about the Python-list mailing list