mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Don't use true division where int division was intended. For that matter,
don't use division at all.
This commit is contained in:
parent
b481286504
commit
d9ea39db84
2 changed files with 2 additions and 2 deletions
|
@ -8,7 +8,7 @@ import random
|
|||
def check_invariant(heap):
|
||||
# Check the heap invariant.
|
||||
for pos, item in enumerate(heap):
|
||||
parentpos = (pos+1)/2 - 1
|
||||
parentpos = ((pos+1) >> 1) - 1
|
||||
if parentpos >= 0:
|
||||
verify(heap[parentpos] <= item)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue