[Python-3000-checkins] r56037 - python/branches/p3yk/Lib/pydoc.py

georg.brandl python-3000-checkins at python.org
Tue Jun 19 14:33:23 CEST 2007


Author: georg.brandl
Date: Tue Jun 19 14:33:20 2007
New Revision: 56037

Modified:
   python/branches/p3yk/Lib/pydoc.py
Log:
Patch #1739659: don't slice dict.keys() in pydoc.


Modified: python/branches/p3yk/Lib/pydoc.py
==============================================================================
--- python/branches/p3yk/Lib/pydoc.py	(original)
+++ python/branches/p3yk/Lib/pydoc.py	Tue Jun 19 14:33:20 2007
@@ -1750,17 +1750,16 @@
 ''' % sys.version[:3])
 
     def list(self, items, columns=4, width=80):
-        items = items[:]
-        items.sort()
-        colw = width / columns
-        rows = (len(items) + columns - 1) / columns
+        items = list(sorted(items))
+        colw = width // columns
+        rows = (len(items) + columns - 1) // columns
         for row in range(rows):
             for col in range(columns):
                 i = col * rows + row
                 if i < len(items):
                     self.output.write(items[i])
                     if col < columns - 1:
-                        self.output.write(' ' + ' ' * (colw-1 - len(items[i])))
+                        self.output.write(' ' + ' ' * (colw - 1 - len(items[i])))
             self.output.write('\n')
 
     def listkeywords(self):


More information about the Python-3000-checkins mailing list