[Python-Dev] Multiple dicts for string interpolation?
Guido van Rossum
guido@CNRI.Reston.VA.US
Wed, 26 Jan 2000 07:41:45 -0500
[Tim]
> > format % MultiDict(d1, d2, ...)
> >
> > ? That's exactly the same as the tuple idea, except there's a nice
> > descriptive word in the middle of it <wink>.
Nice.
[Jack]
> I've always wonderer why dict+dict isn't supported (or possibly
> dict|dict, if the key-collision semantics of + on dict are seen as a
> problem). Is there a good reason for this, or is it just that there
> are other more important things to implement?
The reason is that + (or |) looks symmetrical, but for the key
collisions, one of them has to lose. We now have dict1.update(dict2),
which is a bit more cumbersome, but makes it much clearer who is the
loser.
--Guido van Rossum (home page: http://www.python.org/~guido/)