János Juhász wrote: > Dear Tutors! > > I know a python list is a mutable object. >>>> array = [1,2,3,4,5] > > So I can modify any item in it. >>>> for index in range(len(array)): array[index] *= 2 > ... >>>> array > [2, 4, 6, 8, 10] > > So I typed this: >>>> for item in array: item *= 2 > ... >>>> array > [1, 2, 3, 4, 5]
You usually don't do things like that in python as far as I know. You just work on a generated modified list. foo = range(1,6) for i in [x*2 for x in foo]: do_whatever_you_want_with(i) -- ~noufal _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor