Tabs versus Spaces in Source Code
Nick Craig-Wood
nick at craig-wood.com
Wed May 17 07:30:03 EDT 2006
Ant <antroy at gmail.com> wrote:
> I think Duncan has hit the nail on the head here really. I totally
> agree that conceptually using tabs for indentation is better than using
> spaces.
As a programmer tabs appeal to our sense of neatness in python code.
One tab for each level of indent - very nice.
Back in the last century when I wrote nothing but assembler in a
series of primitive text editors I would have agreed with you. Tabs
rule! label TAB opcode TAB arguments TAB ; comment.
> Pragmatically though, you can't tell in an editor where spaces
> are used and where tabs are used.
Now-a-days when I am writing Python, I just use emacs which indents
perfectly. I press tab and emacs inserts the correct of indentation.
Most of the time I don't have to press tab at all - emacs knows how
much indentation I need.
I don't actually care whether emacs inserts spaces or tabs (spaces
actually), it works, looks nice and follows PEP 8. It's a lot less
keystrokes than writing assember too ;-)
If you are writing python using "cat" or "ed" then tabs might matter
again, but for any modern editor with a python mode it really doesn't
matter!
> The following quote sums things up nicely I think:
>
> "In theory there is no difference between theory and practice, but in
> practice there is."
;-)
--
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-list
mailing list