del on os.environ?

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Thu Sep 13 00:06:33 EDT 2001


----- Original Message ----- 
From: "Alex Martelli" <aleax at aleax.it>


> Given the unfortunate nonstandard status of unsetenv,

I don't own a copy of POSIX.1, so I don't know about standardization
of these functions; but I do know that Version 7 Unix, current BSD's,
and GNU libc all contain it.  Win32 offers this functionality by
assigning a null string through the internal _putenv() function.

Just what OS's don't have it?

Guido has expressed displeasure with adding this feature, calling it
code bloat.  I think the current behavior, to wit:

    >>> import os
    >>> del os.environ["HOME"]
    >>> os.system("echo $HOME")
    /var/home/chrisg
    0

is just wrong.  Here's what my patched interpreter does:

    >>> import os
    >>> del os.environ["HOME"]
    >>> os.system("echo $HOME")

    0

In other words, exactly what I expected... exactly what any Pythonian
should expect.







More information about the Python-list mailing list