changeset 26373:aa610ffad4e8

formatter: use dict.update() to set arguments passed to write functions This isn't important, but update() is better than loop in general.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 23 Sep 2015 21:54:47 +0900
parents 55de800937e0
children 048e41e9a6ac
files mercurial/formatter.py
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/formatter.py	Wed Sep 23 21:51:48 2015 +0900
+++ b/mercurial/formatter.py	Wed Sep 23 21:54:47 2015 +0900
@@ -50,14 +50,12 @@
         '''do default text output while assigning data to item'''
         fieldkeys = fields.split()
         assert len(fieldkeys) == len(fielddata)
-        for k, v in zip(fieldkeys, fielddata):
-            self._item[k] = v
+        self._item.update(zip(fieldkeys, fielddata))
     def condwrite(self, cond, fields, deftext, *fielddata, **opts):
         '''do conditional write (primarily for plain formatter)'''
         fieldkeys = fields.split()
         assert len(fieldkeys) == len(fielddata)
-        for k, v in zip(fieldkeys, fielddata):
-            self._item[k] = v
+        self._item.update(zip(fieldkeys, fielddata))
     def plain(self, text, **opts):
         '''show raw text for non-templated mode'''
         pass