surprising behaviour of os.environ.clear

Benjamin musiccomposition at
Sun Jun 29 04:39:03 CEST 2008

On Jun 28, 1:23 am, Tim Roberts <t... at> wrote:
> Benjamin <musiccomposit... at> 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 a UserDict is stored in When
UserDict.clear is called, that contents is simply cleared. environ
needs to override this is to unset env variable and then update the
actual dict.

> --
> Tim Roberts, t... at
> Providenza & Boekelheide, Inc.

More information about the Python-list mailing list