[issue47094] index doesn't change while looping through same elements in a list

2022-03-22 Thread Dennis Sweeney
Dennis Sweeney added the comment: The help text says this: >>> help(list.index) Help on method_descriptor: index(self, value, start=0, stop=9223372036854775807, /) Return first index of value. Raises ValueError if the value is not present. Emphasis

[issue47094] index doesn't change while looping through same elements in a list

2022-03-22 Thread Tk44
New submission from Tk44 : Let us define a list where there are some duplicate elements. If we loop through that list as "for i in my_list" and print the index by my_list.index(i); the index doesn't change. e.g. my_list = [1,1,1,1,3] for elm in my_list: print(my_list.index(elm))