This is an instance of os._Environ :
>>> os.environ.__class__ <class os._Environ at 0x01DDA928>
It is defined in the Python library, the os.py file os.py and cannot be a simple dictionary, because updating the dictionary should also update the process environment. Also, key searches should be case insensitive in Windows.
In Python 2.x, it subclasses UserDict.IterableUserDict , which apparently does not have a new viewkeys() method. In Python 3.x, it implements MutableMapping abc, but does not have other explicit base classes.
source share