Tabs for indentation & Spaces for alignment in Python 3?

Aahan Krish krish at aahan.me
Fri Dec 5 12:40:47 EST 2014


I have two general questions regarding Python that I couldn't find any good
answers for. This is not the often-asked Tabs vs Spaces question, so kindly
read it in whole.

*Q1.* This is not to debate the decision, but I really wanted to know the
reason why PEP 8 chose to go with spaces instead of tabs. I read that tabs
were initially preferred over spaces (esp. Mr. Rossum)? What caused the
decision that spaces are better?

According to Core Python Programming (Book):

...because tabs vary in the number of spaces depending on your system, we
> recommend not using tabs if there is any hint of cross-platform development.
>

Isn't that a feature of tabs? (i.e. allowing the user to configure the size
of a tab stop in his editor, which has no affect whatsoever on the tab
character itself or how it displays in another user's editor.)

Is it the difficulty to adhere to the Maximum Line Length (79) when using
tabs? or is it simply because most of the Python programmers were using
spaces (or were adamant on using them) at the time of the decision-making
process?

*Q2.* PEP 8 also reads, "Python 3 disallows mixing the use of tabs and
spaces for indentation."

So, if I am using tabs for indentation and spaces for alignment, is it
still considered "mixing the use of tabs and spaces" in Python 3? (Please
see this example
<http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/#css>.)

Thank you very much for your time!


Best
Aahan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141205/31a6b811/attachment.html>


More information about the Python-list mailing list