diff options
author | Raymond Hettinger <python@rcn.com> | 2003-11-06 14:06:48 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-11-06 14:06:48 (GMT) |
commit | 85c20a41dfcec04d161ad7da7260e7b94c62d228 (patch) | |
tree | 0d9e5b294ab4890b72ddc61d193036ac1d4b5ca4 /Lib/heapq.py | |
parent | f607fc5395883ff924c76739e9b0921953568e54 (diff) | |
download | cpython-85c20a41dfcec04d161ad7da7260e7b94c62d228.zip cpython-85c20a41dfcec04d161ad7da7260e7b94c62d228.tar.gz cpython-85c20a41dfcec04d161ad7da7260e7b94c62d228.tar.bz2 |
Implement and apply PEP 322, reverse iteration
Diffstat (limited to 'Lib/heapq.py')
-rw-r--r-- | Lib/heapq.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/heapq.py b/Lib/heapq.py index 2c30b12..2223a97 100644 --- a/Lib/heapq.py +++ b/Lib/heapq.py @@ -165,7 +165,7 @@ def heapify(x): # or i < (n-1)/2. If n is even = 2*j, this is (2*j-1)/2 = j-1/2 so # 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): + for i in reversed(xrange(n//2)): _siftup(x, i) # 'heap' is a heap at all indices >= startpos, except possibly for pos. pos |