3 ms·
Python uses all sorts of nonstandard terminology. For instance, in computer science "literal constant" has a very specific meaning. Python calls things "liter
by kazinator 3y ago
Python uses all sorts of nonstandard terminology.
For instance, in computer science "literal constant" has a very specific meaning.
Python calls things "literals" that are obviously not literals; for instance [1, 2, 3] is actually a constructor which allocates a new li^H^Harray each time it is evaluated.
A true literal does no such thing; its syntax retrieves an object which has been placed into the program image; it typically exists before the program even starts.
Programs depend on the semantics of [1, 2, 3] making a new object each time; a Python compiler cannot just deduce that because all arguments are constants, it can be turned into a literal.
You don't want to learn computer science terminology (or computer science at all) from Python.