Re: surprising behaviour of os.environ.clear

2008-06-28 Thread Benjamin
On Jun 28, 1:23 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > Benjamin <[EMAIL PROTECTED]> wrote: > > >This is because of how os.environ is implement with a UserDict > >subclass. > > Why?  I mean, I can see that it happens, but I don't understand why being a > UserDict causes this. The contents of

Re: surprising behaviour of os.environ.clear

2008-06-28 Thread Joe P. Cool
On 28 Jun., 23:06, "Joe P. Cool" <[EMAIL PROTECTED]> wrote: > On 28 Jun., 04:05, Benjamin <[EMAIL PROTECTED]> wrote: > > > On Jun 27, 4:05 pm, "Joe P. Cool" <[EMAIL PROTECTED]> wrote: > > This is because of how os.environ is implement with a UserDict > > subclass. You should report this at bugs.pyt

Re: surprising behaviour of os.environ.clear

2008-06-28 Thread Joe P. Cool
On 28 Jun., 04:05, Benjamin <[EMAIL PROTECTED]> wrote: > On Jun 27, 4:05 pm, "Joe P. Cool" <[EMAIL PROTECTED]> wrote: > This is because of how os.environ is implement with a UserDict > subclass. You should report this at bugs.python.org. issue 3227: os.environ.clear has no effect on child process

Re: surprising behaviour of os.environ.clear

2008-06-28 Thread Joe P. Cool
On 28 Jun., 08:54, [EMAIL PROTECTED] wrote: > For one thing, the expression 'os.environ.keys' will yield a method > object (not a list, as you're probably expecting), but iterating over > a method as you did should produce an exception. If you want to get > the list of environment vars, you have to

Re: surprising behaviour of os.environ.clear

2008-06-27 Thread s0suk3
On Jun 27, 4:05 pm, "Joe P. Cool" <[EMAIL PROTECTED]> wrote: > 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 al

Re: surprising behaviour of os.environ.clear

2008-06-27 Thread Tim Roberts
Benjamin <[EMAIL PROTECTED]> wrote: > >On Jun 27, 4:05 pm, "Joe P. Cool" <[EMAIL PROTECTED]> wrote: >> 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: >>     d

Re: surprising behaviour of os.environ.clear

2008-06-27 Thread Benjamin
On Jun 27, 4:05 pm, "Joe P. Cool" <[EMAIL PROTECTED]> wrote: > 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 al

surprising behaviour of os.environ.clear

2008-06-27 Thread Joe P. Cool
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?