Steve Dower added the comment: This works fine in Python 3, and also Python 2.7 *unless* you call .keys().
PS D:\> py -2.7 Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> 'path' in os.environ, 'path' in os.environ.keys() (True, False) PS D:\> py Python 3.6.0b4 (default, Nov 22 2016, 05:30:12) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import os >>> 'path' in os.environ, 'path' in os.environ.keys() (True, True) I suspect at this point, we aren't going to change this in Python 2.7 unless someone comes up with an incredibly motivating issue. ---------- versions: -Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28824> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com