[issue32300] print(os.environ.keys()) should only print the keys

Serhiy Storchaka report at bugs.python.org
Thu Dec 14 12:14:37 EST 2017


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Options:

1. Use the subclass of KeyView with overridden __repr__ for os.environ.keys(). This will add a code for pretty rare use case.

2. Remove os.environ.__repr__. You can use repr(os.environ.copy()) or repr(dict(os.environ)) if you want to see a content.

3. Do not change anything. You can use repr(list(os.environ.keys())) if you want to see only keys.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32300>
_______________________________________


More information about the Python-bugs-list mailing list