【发布时间】:2015-12-10 05:41:22
【问题描述】:
def threshold(the_list,thresholding_value,upper_val,lower_value):
ret_list=list(the_list)
for each_item in ret_list:
if each_item <= thresholding_value:
each_item=lower_value
else:
each_item=upper_val
return ret_list
temp=[-1,2,5,3,-1,5,32,-6]
ttt=r.threshold(temp,0,1,0)
执行后我仍然得到列表相同的值
【问题讨论】:
标签: python list parameter-passing immutability