[Tutor] Re: tabs vs spaces

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Sun, 22 Jul 2001 18:18:43 -0700 (PDT)


On Thu, 19 Jul 2001, Charlie Clark wrote:

> >BTW, are you using tabs to indent your code? Don't! Use spaces instead.

> I noticed there was a heated discussion on the newsgroup about this a
> while back and I'm sure it crops up often. And the consensus seemed to
> be that spaces are the way to do things. But tabs are allowed. Maybe
> there is a page somewhere that presents the arguments? That would be
> useful to know.

Guido's "Python Style Guide" touches on the debate:

    http://python.sourceforge.net/peps/pep-0008.html

He says to use either tabs or spaces, but make sure to stick to only one
of those choices.  Otherwise, dire catastrophe is bound to strike: tabs
count for 8 spaces in Python, but some systems print out tabs as
four.  It's a big mess.  *grin*

If you use a text editor that's aware of Python, you usually don't need to
worry about the distinction.  In Emacs, PythonWin, and IDLE, pressing TAB
will cause the editor to indent by four spaces, which is very nice.  What
text editor do you use to edit Python code?