We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Expressions can also include function calls (including calling classes for object instantiation). Technically these are "identifiers" exactly like names bound to values in an = statement ... even though the binding is through the 'def' or 'class' keywords. However, for this answer I would separately spell out function calls to make that clear.
@George Fair enough. :) Expression statements are quite useful even outside of the REPL – it's quite common to use function call expressions as expression statements, e.g. print("Hello world!") or my_list.append(42).
@WillTaylor Everything that yields a value is an expression, i.e. everything you could write on the write-hand side of an assignment. Since a = yield 7 is valid, yield 7 is an expression. A long time ago, yield was introduced as a statement, but it was generalized to an expression in PEP 342.
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
complete the sentence: my question is about...
use tags that describe things or concepts that are essential, not incidental to your question
print("Hello world!")ormy_list.append(42).a = yield 7is valid,yield 7is an expression. A long time ago,yieldwas introduced as a statement, but it was generalized to an expression in PEP 342.