Why whitespace is significant in Python

06 Jan 2007 10:24 - (1) comments

From the Daily Kos discussion about how they will build the next version of DailyKos:

Whitespace is significant in Python because it helps you catch mistakes. In block-structured programming languages that use brackets, it is easy for your indentation and your brackets to get out of sync with each other, especially as you make modifications to existing code. Experience has shown that even though the compiler or interpreter reads the brackets, the programmer reads the indentation. This can be a source of frustrating bugs that should be obvious, but prove embarrassingly hard to find.

Python eliminates the problem by making the compiler/interpreter read the same thing that programmers generally do (in practise). If you're used to using brackets, it will annoy you for the first few days, and then you'll forget about it (unless you mix tabs and spaces, in which case your suffering will be legendary, even in Hell).

Comments

http://www.dailykos.com/comments/2007/1/3/182756/0971/321#c321

Google - Linux
Amazon - Linux
YouTube - Linux
CNN - Linux
whitehouse.com - windows 2003

On 06 Jan 10:25 by Echo

Comments have been closed.

Admin