''' Purpose: demonstrate a function side-effect in Python ''' def f( x ) : ''' Does ??? ''' print( "start of f( x ):", id( x ) ) # this is the same as the id from the argument in up.py n = len( x ) for i in range( 0, n ) : x[ i ] = 0 # modifying individual elements but not reassigning x print( "in for loop:", id( x ) ) # when you reassign variables, you lose that original assignment, so if you're using a function to modify a list # that assignment can be lost by saying x = ... # there are times that we want to reassign # we are modifying our argument list because there is no assignment statement that updates the value of x x.append( 1112 ) print( "end of f( x ):", id( x ) ) return