[Python-checkins] python/dist/src/Lib heapq.py, 1.18, 1.19 mhlib.py, 1.35, 1.36 platform.py, 1.8, 1.9 random.py, 1.57, 1.58 rfc822.py, 1.74, 1.75

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Thu Nov 6 09:06:49 EST 2003


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv17028/Lib
Modified Files:
	heapq.py mhlib.py platform.py random.py rfc822.py 
Log Message:
Implement and apply PEP 322, reverse iteration
Index: heapq.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** heapq.py	20 Oct 2003 14:01:49 -0000	1.18
--- heapq.py	6 Nov 2003 14:06:46 -0000	1.19
***************
*** 166,170 ****
 # j-1 is the largest, which is n//2 - 1. If n is odd = 2*j+1, this is
 # (2*j+1-1)/2 = j so j-1 is the largest, and that's again n//2-1.
! for i in xrange(n//2 - 1, -1, -1):
 _siftup(x, i)
 
--- 166,170 ----
 # j-1 is the largest, which is n//2 - 1. If n is odd = 2*j+1, this is
 # (2*j+1-1)/2 = j so j-1 is the largest, and that's again n//2-1.
! for i in reversed(xrange(n//2)):
 _siftup(x, i)
 
Index: mhlib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mhlib.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** mhlib.py	27 Feb 2003 20:14:35 -0000	1.35
--- mhlib.py	6 Nov 2003 14:06:46 -0000	1.36
***************
*** 976,981 ****
 f.putsequences(seqs)
 do('f.getsequences()')
! testfolders.reverse()
! for t in testfolders: do('mh.deletefolder(%s)' % `t`)
 do('mh.getcontext()')
 context = mh.getcontext()
--- 976,980 ----
 f.putsequences(seqs)
 do('f.getsequences()')
! for t in reversed(testfolders): do('mh.deletefolder(%s)' % `t`)
 do('mh.getcontext()')
 context = mh.getcontext()
Index: platform.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** platform.py	2 Nov 2003 09:47:05 -0000	1.8
--- platform.py	6 Nov 2003 14:06:47 -0000	1.9
***************
*** 202,206 ****
 # Check for slackware verson tag file (thanks to Greg Andruk)
 verfiles = os.listdir('/usr/lib/setup')
! for n in range(len(verfiles)-1, -1, -1):
 if verfiles[n][:14] != 'slack-version-':
 del verfiles[n]
--- 202,206 ----
 # Check for slackware verson tag file (thanks to Greg Andruk)
 verfiles = os.listdir('/usr/lib/setup')
! for n in reversed(xrange(len(verfiles))):
 if verfiles[n][:14] != 'slack-version-':
 del verfiles[n]
Index: random.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** random.py	12 Oct 2003 17:14:11 -0000	1.57
--- random.py	6 Nov 2003 14:06:47 -0000	1.58
***************
*** 254,258 ****
 if random is None:
 random = self.random
! for i in xrange(len(x)-1, 0, -1):
 # pick an element in x[:i+1] with which to exchange x[i]
 j = int(random() * (i+1))
--- 254,258 ----
 if random is None:
 random = self.random
! for i in reversed(xrange(1, len(x))):
 # pick an element in x[:i+1] with which to exchange x[i]
 j = int(random() * (i+1))
Index: rfc822.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/rfc822.py,v
retrieving revision 1.74
retrieving revision 1.75
diff -C2 -d -r1.74 -r1.75
*** rfc822.py	11 Sep 2002 02:32:14 -0000	1.74
--- rfc822.py	6 Nov 2003 14:06:47 -0000	1.75
***************
*** 422,427 ****
 if hit:
 list.append(i)
! list.reverse()
! for i in list:
 del self.headers[i]
 
--- 422,426 ----
 if hit:
 list.append(i)
! for i in reversed(list):
 del self.headers[i]
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /