[NCLUG] Looking at programming languages...

Duncan McGreggor duncan.mcgreggor at gmail.com
Thu Jan 17 12:33:59 MST 2008


Walker, Philip M (Optical Storage) wrote:

> Python is good stuff, but one limitation prevents me from becoming enthusiastic:
> 
>  the indentation relies on the assumption that tabs (if present) are unambiguously equivalent to 8 spaces.
> 
> Of course, that assumption is not valid unless your editor is configured that way

I don't know of any python programmer that uses 8 spaces for indent. I
use 4 (with vim). The twisted python coding standard dictates 4. What's
more, the official python coding standard
(http://www.python.org/dev/peps/pep-0008/) suggests 4, saying that 8
should only be used if necessary (e.g., legacy code).

Google actually uses 2 spaces for all their python code. (I only do that
when entering code in the interactive prompt.)

But I am curious: where do you come by this wrong information? In
particular, that python assumes tabs are 8 spaces? I'm curious to know
what demographic believes this to be true when the very thought is
antithetical to every standard I know of and offends the sensibilities
of all the python programmers I know...

> My editor (vim) is configured by default for tabs == 4 spaces, and out of respect for other developers that have to read my code, I always output files with no tabs, but many (most?) Python developers distribute files with mixed tabs and spaces.

Phil, are the python programmers you know newbs? I don't know of *any*
python programmer that mixes tabs and spaces. It's one of the greatest
sins you can commit in python source code, and in fact, will throw an
error if used in the same block of code:

IndentationError: unindent does not match any outer indentation level

Again, I reference the python coding standard which states, in a
one-sentence paragraph (for visibility and emphasis):

"Never mix tabs and spaces."

d






More information about the NCLUG mailing list