def clean(path):
    path1 = []
for x1, y1 in path:
    for i, (x2, y2) in enumerate(path1[:-1]):
        if abs(x1 - x2) <= 1 and abs(y1 - y2) <= 1:
            path1 = path1[:i + 1]
break
path1.append((x1, y1))
return path1
Сократить список кортежей, вырезав циклы?