Language Syntax
Logical lines — Python syntax
A logical line contains one or more simple statements or a compound header. Physical lines can join through delimiters or explicit continuation. NEWLINE tokens mark logical endings; NL tokens mark nonterminating line breaks in tokenization.
Formal Syntax & Structure
python syntaxpython
statement [; statement ...] NEWLINEWorking Example
Example Snippetpython
import io,tokenizesource='x=(1+\n 2)\ny=3\n'tokens=list(tokenize.generate_tokens(io.StringIO(source).readline))print(sum(t.type==tokenize.NEWLINE for t in tokens))