diff options
author | Łukasz Langa <lukasz@langa.pl> | 2010-12-04 11:48:11 (GMT) |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2010-12-04 11:48:11 (GMT) |
commit | 24bcc61f2d8748515356a4e1daac05faed3ae731 (patch) | |
tree | 6116c28c5c12b9eaef751bdb840ea8f435ab21a1 | |
parent | 09b0b3a655fe83b5b2be4f6ba22725c252592665 (diff) | |
download | cpython-24bcc61f2d8748515356a4e1daac05faed3ae731.zip cpython-24bcc61f2d8748515356a4e1daac05faed3ae731.tar.gz cpython-24bcc61f2d8748515356a4e1daac05faed3ae731.tar.bz2 |
configparser: minute refactoring of RawConfigParser.items()
-rw-r--r-- | Lib/configparser.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py index 3c44cf3..eafcea3 100644 --- a/Lib/configparser.py +++ b/Lib/configparser.py @@ -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() |