[Python-Dev] Python Language Reference has no mention of list comÃprehensions

Laura Creighton lac at openend.se
Thu Dec 3 09:26:23 EST 2015


In a message of Thu, 03 Dec 2015 13:37:17 +0000, Paul Moore writes:
>On 3 December 2015 at 12:51, Laura Creighton <lac at openend.se> wrote:
>> Intentional or Oversight?
>
>Hard to find :-)
>
>https://docs.python.org/3/reference/expressions.html#displays-for-lists-sets-and-dictionaries
>
>I went via "Atoms" in the expression section, then followed the links
>in the actual grammar spec.
>
>Paul

I think the whole use of the language displays as in
  
  6.2.4. Displays for lists, sets and dictionaries

  For constructing a list, a set or a dictionary Python provides 
  special syntax called “displays”, each of them in two flavors:

    either the container contents are listed explicitly, or
    they are computed via a set of looping and filtering instructions, 
    called a comprehension.

is very odd.  I don't know anybody who talks of 'displays'.  They
talk of 'two ways to construct a'.  

Who came up with the word 'display' and what does it have going for
it that I have missed?  Right now I think its chief virtue is that
it is a meaningless noun.  (But not meaningless enough, as I
associate displays with output, not construction).

I think that 

    6.2.4 Constructing lists, sets and dictionaries

would be a much more useful title, and

    6.2.4 Constructing lists, sets and dictionaries -- explicitly or through the use of comprehensions

an even better one.

Am I missing something important about the 'display' language?

Laura


More information about the Python-Dev mailing list