[New-bugs-announce] [issue7310] Unhelpful __repr__() in os.environ

Kent Johnson report at bugs.python.org
Thu Nov 12 12:54:01 CET 2009


New submission from Kent Johnson <kent at 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 <report at bugs.python.org>
<http://bugs.python.org/issue7310>
_______________________________________


More information about the New-bugs-announce mailing list