diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2010-02-22 15:59:01 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2010-02-22 15:59:01 (GMT) |
commit | 19e4acfa15ec17a748b26770078aad53aa72475f (patch) | |
tree | 4a5c4429e74258f5320e86600d7d3dd5f894aef3 /Lib/os.py | |
parent | 5961b0e35fa6ff73fd420448270fb3143703c59e (diff) | |
download | cpython-19e4acfa15ec17a748b26770078aad53aa72475f.zip cpython-19e4acfa15ec17a748b26770078aad53aa72475f.tar.gz cpython-19e4acfa15ec17a748b26770078aad53aa72475f.tar.bz2 |
#7310: fix the repr() of os.environ
Diffstat (limited to 'Lib/os.py')
-rw-r--r-- | Lib/os.py | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -387,22 +387,32 @@ class _Environ(MutableMapping): self.data = data = {} for key, value in environ.items(): data[keymap(key)] = str(value) + def __getitem__(self, key): return self.data[self.keymap(key)] + def __setitem__(self, key, value): value = str(value) self.putenv(key, value) self.data[self.keymap(key)] = value + def __delitem__(self, key): self.unsetenv(key) del self.data[self.keymap(key)] + def __iter__(self): for key in self.data: yield key + def __len__(self): return len(self.data) + + def __repr__(self): + return 'environ({!r})'.format(self.data) + def copy(self): return dict(self) + def setdefault(self, key, value): if key not in self: self[key] = value |