[issue20402] List comprehensions should be noted in for loop documentation

Westley Martínez report at bugs.python.org
Tue Feb 18 01:46:59 CET 2014


Westley Martínez added the comment:

I'm curious what the best way to do this would be.  Obviously the simplest would just be 'See also list comprehensions.'  However since this is a tutorial, I was thinking of adding something like this:
'In other languages, for loops are often used to fill a sequence with data.  While this method works just as well in Python, it is often better to use a list comprehension' and then there could be an example like that found here:
http://docs.python.org/2/tutorial/datastructures.html#list-comprehensions

Followed by a link to more info on list comprehensions.

----------
nosy: +westley.martinez

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20402>
_______________________________________


More information about the Python-bugs-list mailing list