On May 6, 2:10 pm, Steven D'Aprano <[email protected]> wrote: > It's precisely the indentation and colons (plus newlines) that makes > nested for-loops easier to read than list-comps with multiple fors. > > You can get back *nearly* all the readability by splitting the list comp > into multiple lines:
It was less the overall readability I was commenting on, and more the claim that the listcomp required a 'back-and-forth' parsing to understand. As you've reinforced, the listcomp can be readily converted back to the multiple-line form by the inclusion of colons & EOL markers, which means you can make as much sequential sense from a listcomp as you can a for-loop. -- http://mail.python.org/mailman/listinfo/python-list
