> On Dec 3, 2015, at 08:15, MRAB <pyt...@mrabarnett.plus.com> wrote:
> 
>>> On 2015-12-03 15:09, Random832 wrote:
>>> On 2015-12-03, Laura Creighton <l...@openend.se> wrote:
>>> 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).
>> 
>> In a recent discussion it seemed like people mainly use it
>> because they don't like using "literal" for things other than
>> single token constants.  In most other languages' contexts the
>> equivalent thing would be called a literal.
> "Literals" also tend to be constants, or be constructed out of
> constants.

I've seen people saying that before, but I don't know where they get that. It's 
certainly not the way, say, C++ or JavaScript use the term. But I don't see any 
point in arguing about it if people just accept that "literal" is too broad a 
term to capture any useful intuition here. 

> A list comprehension can contain functions, etc.

A non-comprehension display can include function calls, lambdas, or any other 
kind of expression, just as easily as a comprehension can. Is [1, x, f(y), 
lambda z: w+z] a literal? If so, why isn't [i*x for i in y] a literal?

The problem is that we need a word that distinguishes the former; trying to 
press "literal" into service to help the distinction doesn't help.

At some point, Python distinguished between displays and comprehensions; I'm 
assuming someone realized there's no principled sense in which a comprehension 
isn't also a display, and now we're stuck with no word again.

>>> 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
>> 
>> I don't like the idea of calling it "explicit construction".
>> Explicit construction to me means the actual use of a call to the
>> constructor function.

Agreed.

The obvious mathematical terms are "extension" and "intention", but I get the 
feeling nobody would go for that.

Ultimately, the best we have is "displays that aren't comprehensions" or 
"constructions that aren't comprehensions".

Which means that something like "list, set, and dictionary displays (including 
comprehensions)" is about as good as you can make it without inventing a new 
term. There's nothing to contrast comprehensions with.

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to