Author eric.araujo
Recipients docs@python, eric.araujo, ezio.melotti, mark.dickinson, mattlong, terry.reedy
Date 2011-12-08.16:31:53
SpamBayes Score 1.58154e-08
Marked as misclassified No
Message-id <1323361914.33.0.746658220089.issue13549@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2011-12-08 16:31:54eric.araujosetrecipients: + eric.araujo, terry.reedy, mark.dickinson, ezio.melotti, docs@python, mattlong
2011-12-08 16:31:54eric.araujosetmessageid: <1323361914.33.0.746658220089.issue13549@psf.upfronthosting.co.za>
2011-12-08 16:31:53eric.araujolinkissue13549 messages
2011-12-08 16:31:53eric.araujocreate