Consider the following bubble sort program:
arr = map(int, raw_input().split(' '))
print "Unsorted: \n{arr_name}".format(arr_name = arr)
for j in range(len(arr) - 1, 0, -1):
    for i in range(j):
        if (arr[i] > arr[i + 1]):
            arr[i], arr[i + 1] = arr[i +1], arr[i]
print "Sorted: \n{arr_name}".format(arr_name = arr)
Usually a temp variable is used for sorting and that would be mean a space complexity of 0(1). But my understanding is that, tuple swap is only a reassignment of identifiers to objects (link). Does this require any additional space? What would be the space complexity here? Is it still O(1) because a tuple is created?
 
    