Follow

One of the things I like about 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?

@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".

@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".

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.