yet another recipe on string interpolation

Peter Hansen peter at engcorp.com
Thu Nov 4 10:02:01 EST 2004


Michele Simionato wrote:
> I was playing with string.Template in Python 2.4 and I came out with the
> following recipe:
> 
> def merge(*dictionaries):
>     """Merge from right (i.e. the rightmost dictionary has the precedence)."""

> Do you have any comments? Suggestions for improvements?

My only comment is about *your* comment, above.  I would
have called the behaviour described "merge from left".
Maybe best just to cut out that part of the comment, and
leave it as "merge where rightmost dictionary has precedence".

Cute recipe though. :-)

-Peter



More information about the Python-list mailing list