Im using enumerate to obtain the indexes in a list ("i"), but I don't need the value of every element ("j"). "j" is unused in my code, so this is a warning in the eclipse IDE. How I can fix this?
This question is unclear. What is it exactly you are trying to do? What exactly is the error that you are seeing? Please provide a working example that reproduces the error.
@WillemVanOnsem I am aware. But as a general remark as there are other cases where you do not use a value that is returned by a function, e.g. instance, _ = Foo.objects.get_or_create(...)
Sign up to request clarification or add additional context in comments.
Comments
1
Just because an IDE gives you a warning that doesn't mean you have to change your code. @WillemVanOnsem gives you the necessary solution to iterating over the indexes in his comment.
for i in range(len(my_list)):...for i, _ in enumerate(my_list)if you are talking about a warning by your IDEinstance, _ = Foo.objects.get_or_create(...)