Language Syntax

Indentation — Python syntax

Leading whitespace establishes suite boundaries rather than decorative alignment. Inconsistent indentation raises IndentationError; mixing tabs and spaces ambiguously raises TabError. Four spaces is a convention, not a grammar requirement.

Formal Syntax & Structure

python syntaxpython
if condition: NEWLINE INDENT suite DEDENT

Working Example

Example Snippetpython
seen=[]if True:    seen.append('inside')seen.append('outside')print(seen)
Python Reference