[issue7310] Unhelpful __repr__() in os.environ
Ezio Melotti ezio.melo...@gmail.com added the comment: Do you have any preference about the text that should appear in the repr? There have been some discussion on #python-dev about it, and the two main proposal were: 1) _Environ({...}) - the right class name but kind of ugly and probably unnecessary (if no one cares about the name of the real class); 2) environ({...}) - non-existing name, but enough to clarify that it's not a plain dict and less ugly name; -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7310] Unhelpful __repr__() in os.environ
R. David Murray rdmur...@bitdance.com added the comment: I like (2). If someone tries to use the repr to recreate the object, it will fail with a message that mentions _Environ. So no information is lost, I think, by using (2). -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7310] Unhelpful __repr__() in os.environ
Changes by Ezio Melotti ezio.melo...@gmail.com: Removed file: http://bugs.python.org/file15348/issue7310.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7310] Unhelpful __repr__() in os.environ
Ezio Melotti ezio.melo...@gmail.com added the comment: New patch, I added the _Environ() around the dict in the repr and improved the tests. -- Added file: http://bugs.python.org/file15592/issue7310.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7310] Unhelpful __repr__() in os.environ
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: A unit test would be appreciated. It should check that the output looks like a dict. -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7310] Unhelpful __repr__() in os.environ
Changes by Ezio Melotti ezio.melo...@gmail.com: Removed file: http://bugs.python.org/file15327/issue7310.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7310] Unhelpful __repr__() in os.environ
Ezio Melotti ezio.melo...@gmail.com added the comment: New patch that includes a unittest. I was also considering to replace the repr() with something that looks like _Environ({dict-here}). That will still contain all the information and also clarify that os.environ is not just a simple dict. (Even if it's probably not relevant, if we want eval(repr(os.environ)) to work, the repr() should also include the other args accepted by the _Environ() constructor.) If you think this is a good idea I can make a new patch, otherwise, if the current patch is fine, I'll commit it as it is. -- Added file: http://bugs.python.org/file15348/issue7310.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7310] Unhelpful __repr__() in os.environ
Ezio Melotti ezio.melo...@gmail.com added the comment: Here is a patch against py3k. -- assignee: - ezio.melotti keywords: +easy, patch nosy: +ezio.melotti priority: - normal stage: - patch review versions: +Python 3.2 Added file: http://bugs.python.org/file15327/issue7310.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7310] Unhelpful __repr__() in os.environ
Changes by Ezio Melotti ezio.melo...@gmail.com: -- keywords: +needs review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7310] Unhelpful __repr__() in os.environ
New submission from Kent Johnson k...@kentsjohnson.com: In Python 2.x, os.environ extends UserDict.IterableUserDict and therefore os.environ.__repr__() shows the environment. This makes it easy and intuitive to view the entire environment in the interactive interpreter. In Python 3.1, os.environ extends _abcoll.MutableMapping and uses object.__repr__(). This is a much less useful representation. I suggest adding this __repr__() method to class os._Environ (os.py line 380): def __repr__(self): return repr(self.data) -- components: Library (Lib) messages: 95160 nosy: kjohnson severity: normal status: open title: Unhelpful __repr__() in os.environ type: behavior versions: Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com