parameters: (alist, first, last)
return_statement: return right_to_left
docstring: Partition alist into smaller and larger values.
  
      Returns pivot position.
docstring_summary: Partition alist into smaller and larger values.
docstring_tokens: Partition alist into smaller and larger values .
function: def partition(alist, first, last):
      """
      Partition alist into smaller and larger values.
  
      Returns pivot position.
      """
      pivot_value = alist[first]
      left_to_right, right_to_left = first + 1, last
      done = False
      while not done:
          while (left_to_right <= right_to_left and
                  alist[left_to_right] <= pivot_value):
              left_to_right = left_to_right + 1
          while (alist[right_to_left] >= pivot_value and
                  left_to_right <= right_to_left):
              right_to_left = right_to_left - 1
          if right_to_left < left_to_right:
              done = True
          else:
              temp = alist[left_to_right]
              alist[left_to_right] = alist[right_to_left]
              alist[right_to_left] = temp
      alist[first], alist[right_to_left] = alist[right_to_left], alist[first]
      return right_to_left
function_tokens: def partition ( alist , first , last ) : pivot_value = alist [ first ] left_to_right , right_to_left = first + 1 , last done = False while not done : while ( left_to_right <= right_to_left and alist [ left_to_right ] <= pivot_value ) : left_to_right = left_to_right + 1 while ( alist [ right_to_left ] >= pivot_value and left_to_right <= right_to_left ) : right_to_left = right_to_left - 1 if right_to_left < left_to_right : done = True else : temp = alist [ left_to_right ] alist [ left_to_right ] = alist [ right_to_left ] alist [ right_to_left ] = temp alist [ first ] , alist [ right_to_left ] = alist [ right_to_left ] , alist [ first ] return right_to_left