[Python-checkins] r69003 - python/trunk/Lib/posixpath.py

benjamin.peterson python-checkins at python.org
Tue Jan 27 04:07:53 CET 2009


Author: benjamin.peterson
Date: Tue Jan 27 04:07:53 2009
New Revision: 69003

Log:
excellent place to use a set() #5069

Modified:
   python/trunk/Lib/posixpath.py

Modified: python/trunk/Lib/posixpath.py
==============================================================================
--- python/trunk/Lib/posixpath.py	(original)
+++ python/trunk/Lib/posixpath.py	Tue Jan 27 04:07:53 2009
@@ -369,12 +369,12 @@
     until we either arrive at something that isn't a symlink, or
     encounter a path we've seen before (meaning that there's a loop).
     """
-    paths_seen = []
+    paths_seen = set()
     while islink(path):
         if path in paths_seen:
             # Already seen this path, so we must have a symlink loop
             return None
-        paths_seen.append(path)
+        paths_seen.add(path)
         # Resolve where the link points to
         resolved = os.readlink(path)
         if not isabs(resolved):


More information about the Python-checkins mailing list