3 ms·
A for loop with more than four lines of internal logic probably does need to be refactored. A for loop with less lines can usually be turned into a list compreh
by barfbagginus 2y ago
A for loop with more than four lines of internal logic probably does need to be refactored. A for loop with less lines can usually be turned into a list comprehension or invocation of the map function. But a four loop with just a few lines is often clean and easy enough to understand, and will pass my review.
I'm assuming we're working in Python here, which are already much more elegant and pythonic than C/C++ style loops:
for i in my_iterable:
...