Apr-26-2023, 10:21 PM
To be clear, this is a comprehension.
[[] for _ in indices]This is just a for loop where I don't plan to use the index value.
for _ in indicesI could write it like this:
for i in indicesBut static analysis tools rightfully complain about assigning values to a variable and then never using the variable. Using "_" as a placeholder for the index variable tells is a way of telling Python you want a loop that executes some number of times and that is all.