One of the things I like about #Python is the ability to create anonymous lists, tuples, dictionaries, and sets right where they are needed.
[1, 2, 3] is a list literal.
Question: does [a, b, c], where a and so forth are variable names, count as a literal? If (as I suspect) not, what is the proper term?
@LouisIngenthron A variable is by definition not a literal, right? My understanding is that a literal means "this exact value, unaffected by anything elsewhere in the code".
@peterdrake literal expression, maybe.
Acgirding to https://docs.python.org/3/reference/lexical_analysis.html#literals and https://docs.python.org/3/reference/expressions.html#literals a list is not a literal.
They are called "displays" https://docs.python.org/3/reference/expressions.html#list-displays
@peterdrake Not a python expert, but if it's internally consistent, then the list would be a literal, but the variables could be references or literals based on their original type.
Another term for this, however, would be "inline instantiation".