diff options
author | Leonardo Freua <leonardo.batista.freua@gmail.com> | 2021-07-20 17:15:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-20 17:15:45 (GMT) |
commit | 85fa3b6b7c11897732fedc443db0e4e8e380c8f8 (patch) | |
tree | 98985ed2b78e1ec4689b1da1204b729cfe2deab3 /Lib/os.py | |
parent | 42205ee512159de62c01e202ff799d78fac9ac26 (diff) | |
download | cpython-85fa3b6b7c11897732fedc443db0e4e8e380c8f8.zip cpython-85fa3b6b7c11897732fedc443db0e4e8e380c8f8.tar.gz cpython-85fa3b6b7c11897732fedc443db0e4e8e380c8f8.tar.bz2 |
bpo-44631: Make the repr() of the _Environ class more readable. (#27128)
Co-authored-by: Ćukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Lib/os.py')
-rw-r--r-- | Lib/os.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -704,9 +704,11 @@ class _Environ(MutableMapping): return len(self._data) def __repr__(self): - return 'environ({{{}}})'.format(', '.join( - ('{!r}: {!r}'.format(self.decodekey(key), self.decodevalue(value)) - for key, value in self._data.items()))) + formatted_items = ", ".join( + f"{self.decodekey(key)!r}: {self.decodevalue(value)!r}" + for key, value in self._data.items() + ) + return f"environ({{{formatted_items}}})" def copy(self): return dict(self) |