Éric Araujo <mer...@netwok.org> added the comment: I welcome improvements to this part of the docs. Nested list comps had me quite confused at first: I had to write and execute them to understand how it worked. So, the patch looks good to me. Remarks:
- I’d recommend a few whitespace beautifications, like in ``for x in [1,2,3]`` and ``range(1,6)``. - You changed “If the expression would evaluate to a tuple, it must be parenthesized” to “If the expression is a tuple (e.g. the ``(x, y)`` +in this example), it must be parenthesized”, I guess because either the concept that an expression evaluates to something is (a) incorrect or (b) not appropriate at this stage of the tutorial. I think there is an example that makes that line more understandable, but it’s in the section about tuples, not here in the listcomp section; you may or may not want to improve that too. - +1 for the removal of the half-joking half-recommendation not to use nested list comps (“If you've got the stomach for it, list comprehensions can be nested. They are a powerful tool but -- like all powerful tools -- they need to be used carefully, if at all.”). - Maybe a link to the itertools module is appropriate (either after the combinations example, or after the link to the built-in zip function). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13549> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com