Minor cleanup.

This commit is contained in:
Simon Forman 2020-12-18 16:10:45 -08:00
parent 40a627b5ca
commit aa43eb6684
1 changed files with 5 additions and 7 deletions

View File

@ -206,17 +206,15 @@ def dnd(stack, from_index, to_index):
h, stack = stack h, stack = stack
head.append(h) head.append(h)
diff += 1 diff += 1
stack = item, stack
while head:
stack = head.pop(), stack
else: else:
# from > to # from > to
# so the destination is in the head list # so the destination is in the head list
while head: while diff:
stack = head.pop(), stack stack = head.pop(), stack
from_index -= 1 diff -= 1
if from_index == to_index: stack = item, stack
stack = item, stack while head:
stack = head.pop(), stack
return stack return stack