This patch makes os.environ.clear() to have the same effect as: for name in os.environ.keys(): del os.environ[name] I believe that most people expect the effects to be the same anyway. The practical benefit is a simpler redefinition of the whole environment if desired (e.g. in scripts run via sudo on unix systems).
Shouldn't the first clear() in the patch say "del self.data[key.upper()]" instead of "del self.data[key]"? I also think the patch should include doc change.
On 9/20/07, Raghuram Devarakonda <report@bugs.python.org> wrote: > Shouldn't the first clear() in the patch say "del > self.data[key.upper()]" instead of "del self.data[key]"? I also think > the patch should include doc change. I don't think so -- it goes over self.data.keys() which means they are already uppercase. All of this would be unnecessary if clear() in UserDict were to be changed to for key in self.keys(): del self[key] But that's a much more pervasive change...