formatter: improve implementation of data method
authorDavid M. Carr <david@carrclan.us>
Thu, 20 Sep 2012 23:30:59 -0400
changeset 17630 ff5ed1ecd43a
parent 17629 331d611813ec
child 17631 0b241d7a8c62
formatter: improve implementation of data method This alternate syntax was proposed by Bryan O'Sullivan in a review of 772b3764d3e8. I haven't been able to measure any particular performance difference, but the new syntax is more concise and easier to read.
mercurial/formatter.py
--- a/mercurial/formatter.py	Wed Sep 19 09:38:51 2012 -0700
+++ b/mercurial/formatter.py	Thu Sep 20 23:30:59 2012 -0400
@@ -26,8 +26,7 @@
         self._item = {}
     def data(self, **data):
         '''insert data into item that's not shown in default output'''
-        for k, v in data.iteritems():
-            self._item[k] = v
+        self._item.update(data)
     def write(self, fields, deftext, *fielddata, **opts):
         '''do default text output while assigning data to item'''
         for k, v in zip(fields.split(), fielddata):