Imaginary Panda
Imaginary Panda

Reputation: 1

Does the Python interpreter check indents to be space or tab characters?

For example are 4 space characters equivalent to 1 tab character for new line indents? Or will it only scan for just one and not the other?

Upvotes: 0

Views: 176

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798686

Python 3.x (and Python 2.x when passed -tt) will refuse to run code with mixed tabulation.

Python 2.x without -tt will run code with mixed tabulation, and consider a tab to be equivalent to a run of 8 spaces.

(And Python 2.x with -t will run it, but complain.)

Upvotes: 2

Related Questions