is Comp.Lang.Python very active????
why is a linear search thru a Tuple slower (than thru a (corresponding) List ) ??? sometimes, i 'd like to put meaningless indentations like i do (twice) below ( how can it do this ?) _______________________________ import time X= [x for x in range(10000) ] TupX= tuple(X) SetX= set(X) Items=[20, 30, 100, 200, 1000, 5000, 7000, 8000, 9000 ] Count=1000 Time = time.time() for _ in range(Count): for i in X: test= i*i; test= i*i *i print( ' \t ({0:.4f}) X'.format(time.time()-Time) ) Time = time.time() for _ in range(Count): for i in TupX: test= i*i; test= i*i *i print( ' \t ({0:.4f}) TupX'.format(time.time()-Time) ) Time = time.time() for _ in range(Count): for i in Items: test= i in X print( ' \t ({0:.4f}) i in X'.format(time.time()-Time) ) Time = time.time() for _ in range(Count): for i in Items: test= i in TupX print( ' \t ({0:.4f}) i in TupX'.format(time.time()-Time) ) -- https://mail.python.org/mailman/listinfo/python-list