[Python-checkins] r78037 - in python/trunk/Lib: UserDict.py genericpath.py mimetypes.py posixpath.py rexec.py subprocess.py threading.py urllib.py

georg.brandl python-checkins at python.org
Sat Feb 6 23:59:16 CET 2010


Author: georg.brandl
Date: Sat Feb  6 23:59:15 2010
New Revision: 78037

Log:
No need to assign the results of expressions used only for side effects.

Modified:
   python/trunk/Lib/UserDict.py
   python/trunk/Lib/genericpath.py
   python/trunk/Lib/mimetypes.py
   python/trunk/Lib/posixpath.py
   python/trunk/Lib/rexec.py
   python/trunk/Lib/subprocess.py
   python/trunk/Lib/threading.py
   python/trunk/Lib/urllib.py

Modified: python/trunk/Lib/UserDict.py
==============================================================================
--- python/trunk/Lib/UserDict.py	(original)
+++ python/trunk/Lib/UserDict.py	Sat Feb  6 23:59:15 2010
@@ -98,7 +98,7 @@
             yield k
     def has_key(self, key):
         try:
-            value = self[key]
+            self[key]
         except KeyError:
             return False
         return True

Modified: python/trunk/Lib/genericpath.py
==============================================================================
--- python/trunk/Lib/genericpath.py	(original)
+++ python/trunk/Lib/genericpath.py	Sat Feb  6 23:59:15 2010
@@ -15,7 +15,7 @@
 def exists(path):
     """Test whether a path exists.  Returns False for broken symbolic links"""
     try:
-        st = os.stat(path)
+        os.stat(path)
     except os.error:
         return False
     return True

Modified: python/trunk/Lib/mimetypes.py
==============================================================================
--- python/trunk/Lib/mimetypes.py	(original)
+++ python/trunk/Lib/mimetypes.py	Sat Feb  6 23:59:15 2010
@@ -546,7 +546,6 @@
 
 
 if __name__ == '__main__':
-    import sys
     import getopt
 
     USAGE = """\

Modified: python/trunk/Lib/posixpath.py
==============================================================================
--- python/trunk/Lib/posixpath.py	(original)
+++ python/trunk/Lib/posixpath.py	Sat Feb  6 23:59:15 2010
@@ -139,7 +139,7 @@
 def lexists(path):
     """Test whether a path exists.  Returns True for broken symbolic links"""
     try:
-        st = os.lstat(path)
+        os.lstat(path)
     except os.error:
         return False
     return True

Modified: python/trunk/Lib/rexec.py
==============================================================================
--- python/trunk/Lib/rexec.py	(original)
+++ python/trunk/Lib/rexec.py	Sat Feb  6 23:59:15 2010
@@ -244,7 +244,7 @@
         m.open = m.file = self.r_open
 
     def make_main(self):
-        m = self.add_module('__main__')
+        self.add_module('__main__')
 
     def make_osname(self):
         osname = os.name

Modified: python/trunk/Lib/subprocess.py
==============================================================================
--- python/trunk/Lib/subprocess.py	(original)
+++ python/trunk/Lib/subprocess.py	Sat Feb  6 23:59:15 2010
@@ -920,7 +920,7 @@
             """Wait for child process to terminate.  Returns returncode
             attribute."""
             if self.returncode is None:
-                obj = WaitForSingleObject(self._handle, INFINITE)
+                WaitForSingleObject(self._handle, INFINITE)
                 self.returncode = GetExitCodeProcess(self._handle)
             return self.returncode
 

Modified: python/trunk/Lib/threading.py
==============================================================================
--- python/trunk/Lib/threading.py	(original)
+++ python/trunk/Lib/threading.py	Sat Feb  6 23:59:15 2010
@@ -10,7 +10,6 @@
 
 import warnings
 
-from functools import wraps
 from time import time as _time, sleep as _sleep
 from traceback import format_exc as _format_exc
 from collections import deque

Modified: python/trunk/Lib/urllib.py
==============================================================================
--- python/trunk/Lib/urllib.py	(original)
+++ python/trunk/Lib/urllib.py	Sat Feb  6 23:59:15 2010
@@ -234,7 +234,7 @@
                 hdrs = fp.info()
                 fp.close()
                 return url2pathname(splithost(url1)[1]), hdrs
-            except IOError, msg:
+            except IOError:
                 pass
         fp = self.open(url, data)
         try:
@@ -1277,7 +1277,7 @@
             else:
                 try:
                     # is this a sufficient test for sequence-ness?
-                    x = len(v)
+                    len(v)
                 except TypeError:
                     # not a sequence
                     v = quote_plus(str(v))


More information about the Python-checkins mailing list