NoAtomicExpression

Misconception:

An expression must involve multiple operands combined with operators. An individual literal, like 19, or a variable, like x, or an empty list [] or dictionary {} display is not an expression.

Incorrect

Expressions must consist of more than one piece

Correct

A single piece, like a literal or name, also is an expression

Correction
Here is what's right.

Even 1 is an expression. The same applies to a, or [], or {}. There is no need for an operator. Of course an expression can involve operators, thus 1 + 3 or 1 + a are expressions, too.

Explain by Referring to the Definition

An expression is a piece of code that evaluates to a value. Anything that evaluates to a value is an expression. A single variable name also evaluates to a value, so does an empty list display [] or dictionary display {}, or even a literal (a value that stands for itself).

Explain with Expression Trees

The following tree represents the expression val + 1:

The entire tree, rooted in +, is an expression. Moreover, the subtree rooted in val, which consists of a single node, also is an expression. The same applies to the subtree rooted in 1, which represents the literal 1, which is an expression (that always evaluates to the value 1).

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.