What Is Expression


What Is an expression in Python?

✍: FYIcenter.com


An expression in Python is a sequence of operations or method calls applied on data objects.

An expression has two impacts when executed:

  • Code statements of invoked methods get executed. This may create new data objects, update existing data objects, consume resources, etc.
  • A data object gets returned.

For example, execute following expression:

>>> [1,4,9].append(16)

Python will:

  • Execute the "list" constructor method to create a "list" data object with [1,4,9].
  • Execute the "list.append()" method to update the "list" data object by adding 16 to the end.
  • Return the "None" object.


Evaluation of Expressions

Expressions, Variables and Assignment Statements

Expressions, Variables and Assignment Statements

⇑⇑ Python Tutorials

2018-03-13, 1431🔥, 0💬