[Python-3000-checkins] r55965 - python/branches/py3k-struni/Lib/os.py

guido.van.rossum python-3000-checkins at python.org
Wed Jun 13 23:52:42 CEST 2007


Author: guido.van.rossum
Date: Wed Jun 13 23:52:41 2007
New Revision: 55965

Modified:
   python/branches/py3k-struni/Lib/os.py
Log:
Reduce redundant calls to str() in _Environ class.


Modified: python/branches/py3k-struni/Lib/os.py
==============================================================================
--- python/branches/py3k-struni/Lib/os.py	(original)
+++ python/branches/py3k-struni/Lib/os.py	Wed Jun 13 23:52:41 2007
@@ -424,8 +424,9 @@
         def __getitem__(self, key):
             return self.data[self.keymap(key)]
         def __setitem__(self, key, value):
-            self.putenv(key, str(value))
-            self.data[self.keymap(key)] = str(value)
+            value = str(value)
+            self.putenv(key, value)
+            self.data[self.keymap(key)] = value
         def __delitem__(self, key):
             self.unsetenv(key)
             del self.data[self.keymap(key)]
@@ -438,7 +439,7 @@
             return dict(self)
         def setdefault(self, key, value):
             if key not in self:
-                self[key] = str(value)
+                self[key] = value
             return self[key]
 
     try:


More information about the Python-3000-checkins mailing list