[docs] [issue18612] More elaborate documentation on how list comprehensions and generator expressions relate to each other
report at bugs.python.org
Thu Aug 1 13:23:32 CEST 2013
New submission from uglemat:
Today there are list comprehensions, set comprehensions, dict comprehensions and then... there are generator expressions, which apparently was called 'generator comprehensions' in the original PEP, don't know why that was changed. Some questions arises:
* Are generator expressions a type of list comprehension, or are generator expressions to be considered their own thing.
* Does 'list comprehension' mean a type of comprehension that happens to return a list, or is it to be considered more of a general concept.
I usually talk about 'list comprehension' as a type of comprehension, and 'generator expression' as another type of comprehension, and after investigating whether or not that is correct I couldn't find an answer. On the wikipedia article on list comprension (http://en.wikipedia.org/wiki/List_comprehension#Python) they list generator expressions as well, indicating that it's a type of list comprehension. I think there's a lot of confusion to be had here, and that the documentation should clarify what exactly is meant by 'list comprehensions', regardless of what happens to be the case.
I haven't really a bug report before, so forgive me if I'm doing something wrong. :)
assignee: docs at python
nosy: docs at python, uglemat
title: More elaborate documentation on how list comprehensions and generator expressions relate to each other
versions: Python 3.5
Python tracker <report at bugs.python.org>
More information about the docs