def sublist_swap(lst, a, b, m):
 for i in xrange(m):
  (lst[(a + i)], lst[(b + i)]) = (lst[(b + i)], lst[(a + i)])

def sublist_swap ( lst , a , b , m ) : for i in xrange ( m ) : ( lst [ ( a + i ) ] , lst [ ( b + i ) ] ) = ( lst [ ( b + i ) ] , lst [ ( a + i ) ] )
swaps the elements: lst[a:a+m) with lst[b:b+m) without using extra space .