surprising behaviour of os.environ.clear

Joe P. Cool at
Fri Jun 27 23:05:58 CEST 2008

If I call os.environ.clear in a python program child processes still
see the deleted entries. But when I iterate over the keys like so

names =  os.environ.keys
for k in names:
    del  os.environ[k]

then the entries are also deleted for the child processes. Where is
the difference? Is this a bug?
(Observed in Python 2.5.2)


More information about the Python-list mailing list