]> granicus.if.org Git - python/commitdiff
configparser: minute refactoring of RawConfigParser.items()
authorŁukasz Langa <lukasz@langa.pl>
Sat, 4 Dec 2010 11:48:11 +0000 (11:48 +0000)
committerŁukasz Langa <lukasz@langa.pl>
Sat, 4 Dec 2010 11:48:11 +0000 (11:48 +0000)
Lib/configparser.py

index 3c44cf36f3bd4c5353f922a3db88b3d9efbbc912..eafcea3382f18c6ed33c4a1c25956c3acd5dae28 100644 (file)
@@ -848,15 +848,11 @@ class RawConfigParser(MutableMapping):
         if vars:
             for key, value in vars.items():
                 d[self.optionxform(key)] = value
-        options = list(d.keys())
+        value_getter = lambda option: self._interpolation.before_get(self,
+            section, option, d[option], d)
         if raw:
-            return [(option, d[option])
-                    for option in options]
-        else:
-            return [(option, self._interpolation.before_get(self, section,
-                                                            option, d[option],
-                                                            d))
-                    for option in options]
+            value_getter = lambda option: d[option]
+        return [(option, value_getter(option)) for option in d.keys()]
 
     def optionxform(self, optionstr):
         return optionstr.lower()